Commit c6a417b5 by Mike Zhu

Merge branch 'develop' of cd.i.strikingly.com:shawn.wang/crazyflirt into develop

parents 616e4cb8 354e8916
{ {
"groups": [ "groups": [
{ {
"keys": "bg_jpg,egret_icon_png,description_json,control_jpg,grid_jpg,logo_jpg", "keys": "bg_jpg,egret_icon_png,description_json,control_jpg,grid_jpg,logo_jpg,mask_jpg",
"name": "preload" "name": "preload"
} }
], ],
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
"name": "logo_jpg", "name": "logo_jpg",
"type": "image", "type": "image",
"url": "assets/logo.jpg" "url": "assets/logo.jpg"
},
{
"name": "mask_jpg",
"type": "image",
"url": "assets/mask.jpg"
} }
] ]
} }
\ No newline at end of file
...@@ -33,24 +33,28 @@ class Controller extends egret.Sprite { ...@@ -33,24 +33,28 @@ class Controller extends egret.Sprite {
this.up.graphics.drawRect(93, 0, 80, 80) this.up.graphics.drawRect(93, 0, 80, 80)
this.up.graphics.endFill() this.up.graphics.endFill()
this.up.touchEnabled = true this.up.touchEnabled = true
this.up.alpha = 0
this.up.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this) this.up.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
this.down.graphics.beginFill(0xFF00FF, 1) this.down.graphics.beginFill(0xFF00FF, 1)
this.down.graphics.drawRect(93, 186, 80, 80) this.down.graphics.drawRect(93, 186, 80, 80)
this.down.graphics.endFill() this.down.graphics.endFill()
this.down.touchEnabled = true this.down.touchEnabled = true
this.down.alpha = 0
this.down.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this) this.down.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
this.left.graphics.beginFill(0xFF00FF, 1) this.left.graphics.beginFill(0xFF00FF, 1)
this.left.graphics.drawRect(0, 93, 80, 80) this.left.graphics.drawRect(0, 93, 80, 80)
this.left.graphics.endFill() this.left.graphics.endFill()
this.left.touchEnabled = true this.left.touchEnabled = true
this.left.alpha = 0
this.left.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this) this.left.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
this.right.graphics.beginFill(0xFF00FF, 1) this.right.graphics.beginFill(0xFF00FF, 1)
this.right.graphics.drawRect(186, 93, 80, 80) this.right.graphics.drawRect(186, 93, 80, 80)
this.right.graphics.endFill() this.right.graphics.endFill()
this.right.touchEnabled = true this.right.touchEnabled = true
this.right.alpha = 0
this.right.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this) this.right.addEventListener(egret.TouchEvent.TOUCH_BEGIN, this.controlTouchBegin, this)
controlContainer.addChild(this.up) controlContainer.addChild(this.up)
......
...@@ -29,11 +29,11 @@ class Guy extends egret.Sprite { ...@@ -29,11 +29,11 @@ class Guy extends egret.Sprite {
if(this.x <= 0){ if(this.x <= 0){
this.x = 0 this.x = 0
} }
if(this.y <= 0){ if(this.y <= 15){
this.y = 0 this.y = 15
} }
if(this.y >= 72*9){ if(this.y >= 72*9 + 15){
this.y = 72*9 this.y = 72*9 + 15
} }
if(this.x >= 72*13){ if(this.x >= 72*13){
this.x = 72*13 this.x = 72*13
......
...@@ -12,15 +12,23 @@ class GameScene extends egret.Sprite { ...@@ -12,15 +12,23 @@ class GameScene extends egret.Sprite {
// 初始化(给开始按钮绑定点击事件) // 初始化(给开始按钮绑定点击事件)
private init() { private init() {
// put display object to this scene // 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.controller = new Controller()
this.addChild(this.controller) this.addChild(this.controller)
this.controller.addEventListener("position_change", this.onPositionChange, this) this.controller.addEventListener("position_change", this.onPositionChange, this)
this.map = new Map() this.map = new Map()
this.map.y = 15
this.me.y = 15
this.addChild(this.map) this.addChild(this.map)
this.addChild(this.me) this.addChild(this.me)
} }
private onPositionChange(delta){ private onPositionChange(delta){
this.me.applyDelta(delta.data) this.me.applyDelta(delta.data)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment