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

--

parent 08bf8fe8
This diff is collapsed.
......@@ -26,6 +26,7 @@
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Goods = (function (_super) {
tslib.__extends(Goods, _super);
......@@ -131,13 +132,14 @@
_this.playerCatchX = _this.player.x;
};
_this.onMoveStage = function (e) {
var maxStageBound = props.maxStageBound;
if (_this.gameIng) {
var playerX = _this.playerCatchX + (e.localX - _this.moveCatchX);
if (playerX < 0) {
_this.player.x = 0;
if (playerX < maxStageBound) {
_this.player.x = maxStageBound;
}
else if (playerX + _this.player.width > 750) {
_this.player.x = 750 - _this.player.width;
else if (playerX + _this.player.width + maxStageBound > 750) {
_this.player.x = 750 - maxStageBound - _this.player.width;
}
else {
_this.player.x = playerX;
......@@ -326,9 +328,14 @@
this.goodsItems = [];
};
GameView.prototype.hasHit = function (a, b) {
var playerH = a.height;
console.log("props", props.playerHeight);
if (props.playerHeight) {
playerH = props.playerHeight;
}
if (Math.abs((a.x + a.width / 2) - (b.x + b.width / 2)) < a.width / 2 + b.width / 2
&&
Math.abs((a.y + a.height / 1.3) - (b.y + b.height / 2)) < a.height / 2 + b.height / 2) {
Math.abs((a.y + playerH / 1.3) - (b.y + b.height / 2)) < playerH / 2 + b.height / 2) {
return true;
}
else {
......@@ -337,7 +344,6 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
{
"name": "口红机",
"desc": "口红机模块",
"name": "接粽子",
"desc": "接粽子模块",
"props": {
"playerPositionY": {
"alias": "玩家Y轴位置",
......@@ -27,6 +27,18 @@
"type": "number",
"default": 3
},
"playerHeight": {
"alias": "玩家高度",
"type": "number",
"default": 50
},
"maxStageBound": {
"alias": "最大移动边距",
"type": "number",
"default": -20
},
"gameOverCondition": {
"alias": "游戏结束条件(1:接到炸弹死亡,2:分数负数或接到炸弹死亡)",
"type": "number",
......
......@@ -64,7 +64,7 @@ export default class GameView extends engine.Container {
this.NpcBg.alpha = 1;
this.NpcBg.width = 0;
this.NpcBg.height = 0;
this.addChild(this.NpcBg)
this.addChild(this.NpcBg);
......@@ -297,11 +297,17 @@ export default class GameView extends engine.Container {
* @param b b盒子
*/
private hasHit(a, b) {
let playerH=a.height
console.log("props",props.playerHeight)
if(props.playerHeight){
playerH=props.playerHeight
}
if (
Math.abs((a.x + a.width / 2) - (b.x + b.width / 2)) < a.width / 2 + b.width / 2
&&
// Math.abs((a.y + a.height / 2 ) - (b.y + b.height / 2)) < a.height / 2 + b.height / 2
Math.abs((a.y + a.height / 1.3 ) - (b.y + b.height / 2)) < a.height / 2 + b.height / 2
Math.abs((a.y + playerH / 1.3 ) - (b.y + b.height / 2)) < playerH / 2 + b.height / 2
) {
return true;
} else {
......@@ -315,12 +321,13 @@ export default class GameView extends engine.Container {
}
private onMoveStage = (e) => {
let maxStageBound=props.maxStageBound;
if (this.gameIng) {
let playerX=this.playerCatchX + (e.localX - this.moveCatchX)
if(playerX<0){
this.player.x=0
}else if(playerX+this.player.width>750){
this.player.x=750-this.player.width
if(playerX<maxStageBound){
this.player.x=maxStageBound
}else if(playerX+this.player.width+maxStageBound>750){
this.player.x=750-maxStageBound-this.player.width
}else{
this.player.x=playerX
}
......
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