Commit a273c0cb authored by 任建锋's avatar 任建锋

修复-1

parent 8927f1fd
No preview for this file type
This diff is collapsed.
This diff is collapsed.
......@@ -25,6 +25,7 @@
inst.source = 'asset://' + getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Goods = (function (_super) {
tslib.__extends(Goods, _super);
......@@ -332,6 +333,9 @@
this.timer = setTimeout(function () {
if (_this.gameIng) {
_this.speed += props.acceleratedSpeed;
if (_this.speed > props.maxSpeed) {
_this.speed = props.maxSpeed;
}
_this.creatNpc();
}
_this.beginNpc();
......@@ -371,7 +375,7 @@
}
else if (goods["npcType"] == "rain1") {
console.log("碰到雨滴");
_this.score += props.rainScore;
_this.score += props.rain2Score;
_this.setBoomPosition(_this.water2Svga);
engine.Tween.get(goods, null, null, true)
.to({ scaleX: 0, scaleY: 0 }, 200)
......@@ -445,7 +449,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......
......@@ -293,6 +293,9 @@ export default class GameView extends engine.Container {
this.timer = setTimeout(() => {
if (this.gameIng) {
this.speed += props.acceleratedSpeed;
if(this.speed>props.maxSpeed){
this.speed=props.maxSpeed
}
this.creatNpc()
}
//递归执行
......@@ -344,6 +347,9 @@ export default class GameView extends engine.Container {
if (goods["npcType"] == "rain0") {
console.log("碰到雨滴")
this.score += props.rainScore
if(this.score<0){
this.score=0;
}
this.setBoomPosition(this.waterSvga)
engine.Tween.get(goods, null, null, true)
.to({scaleX: 0,scaleY:0}, 200)
......@@ -352,7 +358,10 @@ export default class GameView extends engine.Container {
}else if (goods["npcType"] == "rain1") {
console.log("碰到雨滴")
this.score += props.rainScore
this.score += props.rain2Score
if(this.score<0){
this.score=0;
}
this.setBoomPosition(this.water2Svga)
engine.Tween.get(goods, null, null, true)
.to({scaleX: 0,scaleY:0}, 200)
......
......@@ -12,7 +12,6 @@
function injectProps(p) {
engine.injectProp(props, p);
}
//# sourceMappingURL=props.js.map
function getTextureByName(name) {
return engine.Texture.from(getAssetByName(name).uuid);
......@@ -22,7 +21,6 @@
inst.source = 'asset://' + getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Goods = (function (_super) {
tslib.__extends(Goods, _super);
......@@ -104,7 +102,6 @@
});
return Goods;
}(engine.Container));
//# sourceMappingURL=Goods.js.map
var ObjectPool = engine.ObjectPool;
var PoolName = 'goods';
......@@ -113,7 +110,6 @@
}, function (item, data) {
item.reset();
});
//# sourceMappingURL=object-pool-init.js.map
var ObjectPool$1 = engine.ObjectPool;
var GameView = (function (_super) {
......@@ -197,6 +193,7 @@
this.rectBg.addEventListener(engine.MouseEvent.MOUSE_OUT, this.onOutStage, this);
};
GameView.prototype.reset = function () {
this.score = 0;
this.recycleGoods();
this.player.x = 375 - this.player.width / 2;
};
......@@ -268,10 +265,16 @@
_this.waterSvga.once(engine.Event.END_FRAME, function () {
_this.waterSvga.visible = false;
}, _this);
if (_this.score < 0) {
_this.score = 0;
}
}
else if (goods["npcType"] == "stone") {
console.log("碰到石头");
_this.score += props.stoneScore;
if (_this.score < 0) {
_this.score = 0;
}
_this.stoneSvga.visible = true;
_this.stoneSvga.play(false, false);
_this.stoneSvga.once(engine.Event.END_FRAME, function () {
......@@ -282,13 +285,13 @@
console.log("碰到炸弹");
_this.boomSvga.visible = true;
_this.boomSvga.play(false, false);
_this.died();
_this.boomSvga.once(engine.Event.END_FRAME, function () {
_this.boomSvga.visible = false;
engine.globalEvent.dispatchEvent('food-fell-game-over', {
score: _this.score,
reason: 2
});
_this.died();
}, _this);
}
engine.globalEvent.dispatchEvent('food-fell-score-update', {
......@@ -301,7 +304,6 @@
}, this);
};
GameView.prototype.died = function () {
this.score = 0;
this.pause();
};
GameView.prototype.removeNpc = function (goods) {
......@@ -349,7 +351,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......@@ -392,7 +393,6 @@
};
return GameWrapper;
}(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) {
prepareProps();
......@@ -400,7 +400,6 @@
var instance = new GameWrapper();
return instance;
}
//# sourceMappingURL=index.js.map
return index;
......
This diff is collapsed.
......@@ -140,6 +140,7 @@ export default class GameView extends engine.Container {
* 重置场景
*/
reset() {
this.score = 0
this.recycleGoods()
this.player.x = 375 - this.player.width / 2;
}
......@@ -229,7 +230,7 @@ export default class GameView extends engine.Container {
if (this.hasHit(this.player, goods)) {
if (goods["npcType"].indexOf("rain") > -1) {
console.log("碰到雨滴")
this.score += props.rainScore
this.score += props.rainScore;
this.waterSvga.visible=true;
// this.waterSvga.x= goods.x - this.player.x;
this.waterSvga.play(false, false)
......@@ -237,9 +238,16 @@ export default class GameView extends engine.Container {
this.waterSvga.visible=false;
}, this);
if(this.score<0){
this.score=0;
}
} else if (goods["npcType"] == "stone") {
console.log("碰到石头")
this.score += props.stoneScore
if(this.score<0){
this.score=0;
}
this.stoneSvga.visible=true;
this.stoneSvga.play(false, false)
this.stoneSvga.once(engine.Event.END_FRAME, ()=>{
......@@ -249,13 +257,13 @@ export default class GameView extends engine.Container {
console.log("碰到炸弹")
this.boomSvga.visible=true;
this.boomSvga.play(false, false)
this.died()
this.boomSvga.once(engine.Event.END_FRAME, ()=>{
this.boomSvga.visible=false;
engine.globalEvent.dispatchEvent('food-fell-game-over', {
score: this.score,
reason: 2
});
this.died()
}, this);
}
engine.globalEvent.dispatchEvent('food-fell-score-update', {
......@@ -273,7 +281,6 @@ export default class GameView extends engine.Container {
* 玩家死亡
*/
private died() {
this.score = 0
this.pause()
}
......
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