Commit b193474d authored by haiyoucuv's avatar haiyoucuv

init

parent 28c24165
...@@ -1064,8 +1064,8 @@ ...@@ -1064,8 +1064,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 163, "width": 100,
"height": 181 "height": 100
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1159,7 +1159,7 @@ ...@@ -1159,7 +1159,7 @@
"x": 0, "x": 0,
"y": 0 "y": 0
}, },
"_radius": 60, "_radius": 50,
"_id": "35XBcgL4hOhYpj8xmXzP8l" "_id": "35XBcgL4hOhYpj8xmXzP8l"
}, },
{ {
...@@ -1174,8 +1174,8 @@ ...@@ -1174,8 +1174,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 40, "width": 0,
"height": 36 "height": 0
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
...@@ -185,7 +185,7 @@ export class MainGame extends Scene { ...@@ -185,7 +185,7 @@ export class MainGame extends Scene {
if (this.state == GameState.READY) return; if (this.state == GameState.READY) return;
// 更新UI提示 // 更新UI提示
this.LTips.string = `长度:${this.snake.getSnakeLen()} 金币:${this.snake.getMoneySum()}`; this.LTips.string = `长度:${this.snake.getSnakeLen()}}`;
this.snake.setAngle((360 - this.joystick.angle) % 360); this.snake.setAngle((360 - this.joystick.angle) % 360);
...@@ -226,7 +226,7 @@ export class MainGame extends Scene { ...@@ -226,7 +226,7 @@ export class MainGame extends Scene {
break; break;
case GameState.WIN: case GameState.WIN:
director.pause(); director.pause();
console.log("win", this.snake.getSnakeLen(), this.snake.getMoneySum()); console.log("win", this.snake.getSnakeLen());
break; break;
case GameState.QUIT: case GameState.QUIT:
director.resume(); director.resume();
...@@ -250,7 +250,7 @@ export class MainGame extends Scene { ...@@ -250,7 +250,7 @@ export class MainGame extends Scene {
} }
showGOver() { showGOver() {
console.log("showGOver", this.snake.getSnakeLen(), this.snake.getMoneySum()); console.log("showGOver", this.snake.getSnakeLen());
} }
initItem = (index: number) => { initItem = (index: number) => {
......
...@@ -56,7 +56,6 @@ export class Snake extends Component { ...@@ -56,7 +56,6 @@ export class Snake extends Component {
private speed: number = 600; private speed: number = 600;
private energy: number = 0; private energy: number = 0;
private tag: number = 0; private tag: number = 0;
private moneySum: number = 0;
// 位置相关 // 位置相关
private vw: number = Global.visibleSize.width / 2 + 100; private vw: number = Global.visibleSize.width / 2 + 100;
...@@ -76,7 +75,6 @@ export class Snake extends Component { ...@@ -76,7 +75,6 @@ export class Snake extends Component {
await this.setSkin(skinName); await this.setSkin(skinName);
this.ready = false; this.ready = false;
this.moneySum = 0;
this.energy = 0; this.energy = 0;
this.bodyArr = []; this.bodyArr = [];
this.scale = scale; this.scale = scale;
...@@ -96,7 +94,7 @@ export class Snake extends Component { ...@@ -96,7 +94,7 @@ export class Snake extends Component {
collider.tag = this.tag; collider.tag = this.tag;
body.angle = angle; body.angle = angle;
body.setPosition(-9999, -9999); body.setPosition(-99999, -99999);
body.setScale(scale, scale); body.setScale(scale, scale);
// 设置身体部分的贴图 // 设置身体部分的贴图
...@@ -117,7 +115,6 @@ export class Snake extends Component { ...@@ -117,7 +115,6 @@ export class Snake extends Component {
this.imgBody2 = skin.getSpriteFrame("body2"); this.imgBody2 = skin.getSpriteFrame("body2");
} }
onEnable() { onEnable() {
const collider = this.head.getComponent(Collider2D); const collider = this.head.getComponent(Collider2D);
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginHead, this); collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginHead, this);
...@@ -152,8 +149,6 @@ export class Snake extends Component { ...@@ -152,8 +149,6 @@ export class Snake extends Component {
if (foodType == FoodType.FOOD) { if (foodType == FoodType.FOOD) {
this.addEnergy(1); this.addEnergy(1);
} else if (foodType == FoodType.MONEY) {
this.moneySum += 1;
} }
// 生成新的食物 // 生成新的食物
...@@ -295,10 +290,6 @@ export class Snake extends Component { ...@@ -295,10 +290,6 @@ export class Snake extends Component {
return this.bodyArr.length; return this.bodyArr.length;
} }
getMoneySum() {
return this.moneySum;
}
reInit(e, t) { reInit(e, t) {
this.head.angle = 0; this.head.angle = 0;
this.head.setPosition(e, t); this.head.setPosition(e, t);
......
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