Commit e707eaf2 by Shawn Wang

loop and control boundery

parent 3f9c7cd9
...@@ -87,7 +87,20 @@ class Controller extends egret.Sprite { ...@@ -87,7 +87,20 @@ class Controller extends egret.Sprite {
delta.x += 1 delta.x += 1
} }
let newX = this.myPosition.x + delta.x
let newY = this.myPosition.y + delta.y
if(newX < 0){
newX = 0
}
if(newY < 0){
newY = 0
}
if(newX >= 13){
newX = 13
}
if(newY >= 9){
newY = 9
}
platform.sendSocketMessage({ platform.sendSocketMessage({
data: JSON.stringify({ data: JSON.stringify({
...@@ -95,8 +108,8 @@ class Controller extends egret.Sprite { ...@@ -95,8 +108,8 @@ class Controller extends egret.Sprite {
room_id: 'default_room', room_id: 'default_room',
cid: Store.getState().cid, cid: Store.getState().cid,
payload: { payload: {
x: this.myPosition.x + delta.x, x: newX,
y: this.myPosition.y + delta.y, y: newY,
avatar_url: Store.getState().userInfo.avatarUrl, avatar_url: Store.getState().userInfo.avatarUrl,
nick_name: Store.getState().userInfo.nickName nick_name: Store.getState().userInfo.nickName
} }
......
...@@ -70,7 +70,7 @@ class Main extends egret.DisplayObjectContainer { ...@@ -70,7 +70,7 @@ class Main extends egret.DisplayObjectContainer {
}) })
console.log(userInfo); console.log(userInfo);
SoundManager.getInstance().play({soundName: "bgm_mp3"}) SoundManager.getInstance().play({soundName: "bgm_mp3", startTime: 0, loops: -1})
platform.onShareAppMessage((...args) => { platform.onShareAppMessage((...args) => {
return { return {
title: "恶魔妈妈买面膜", title: "恶魔妈妈买面膜",
......
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