Commit b193474d authored by haiyoucuv's avatar haiyoucuv

init

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