
class GameScene extends egret.Sprite {
  private controller: egret.Sprite
  public map
  public constructor() {
    super();
    this.init()
  }

  private me = new Guy()

  // 初始化(给开始按钮绑定点击事件)
  private init() {
    // put display object to this scene

    let bg = new egret.Shape()
    bg.graphics.beginFill(0x343e5f, 1)
    bg.graphics.drawRect(0,0,1334, 750)
    bg.graphics.endFill()
    this.addChild(bg)

    this.controller = new Controller()
    this.addChild(this.controller)
    this.controller.addEventListener("position_change", this.onPositionChange, this)
    this.map = new Map()
    this.map.y = 15
    this.map.x = 10
    this.me.y = 15
    this.me.x = 10
    this.addChild(this.map)
    this.map.addChild(this.me)
  }

  private onPositionChange(delta){
    this.me.applyDelta(delta.data)
  }

  public release() {
    // 移除事件
  }
}