import { CONST } from '../const/const' ; import { ICursorConstructor } from '../interfaces/cursor.interface' ; export class Cursor extends Phaser . GameObjects . Image { private currentPosition : [ number , number ] ; private activated : boolean ; constructor ( aParams ) { super ( aParams . scene , aParams . x , aParams . y , aParams . texture , aParams . cursorStartPosition ) ; this . currentPosition = aParams . cursorStartPosition ; this . initVariables ( ) ; this . initImage ( ) ; this . scene . add . existing ( this ) ; } private initVariables ( ) { this . activated = false ; } private initImage ( ) { this . setOrigin ( 0 , 0 ) ; } public moveTo ( x , y ) { this . currentPosition = [ x , y ] ; this . setPosition ( x * CONST . tileSize , y * CONST . tileSize ) ; } public getX ( ) { return this . currentPosition [ 0 ] ; } public getY ( ) { return this . currentPosition [ 1 ] ; } public isActivated ( ) { return this . activated ; } public setActivated ( ) { this . activated = ! this . activated ; } }