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

--

parent cb8f7b3e
This diff is collapsed.
declare function getAssetByUUID(uuid: string);
declare function getProps():any;
declare function getAssetByName(name: string);
declare function getProps():any;
\ No newline at end of file
......@@ -3,12 +3,6 @@
*/
const assets = [
{
"name": "玩家icon",
"url": "//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png",
"uuid": "66f23d13-82a5-4cec-9496-301ec240d087",
"ext": ".png"
},
{
"name": "雨滴0",
"url": "//yun.duiba.com.cn/aurora/assets/badb3627bbcc75276a3eed53daa8b0a454ced6eb.png",
......@@ -57,12 +51,6 @@ const assets = [
"uuid": "d7a3947b-7fcb-48f2-9ddf-2f075d37a619",
"ext": ".svga"
},
{
"name": "炸弹",
"url": "//yun.duiba.com.cn/aurora/assets/3b58e7ace031b09c651cf8e7202f9c86e86852c9.svga",
"uuid": "d7a3947b-7fcb-48f2-9ddf-2f075d37a619",
"ext": ".svga"
},
{
"name": "玩家",
"url": "//yun.duiba.com.cn/aurora/assets/db0130d36ef79865be9c753ea0627027f16341d8.png",
......
......@@ -14,19 +14,14 @@
}
//# sourceMappingURL=props.js.map
function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid);
}
function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
return engine.Texture.from(getAssetByName(name).uuid);
}
function createSvga(name, anchorName) {
console.log();
var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
inst.source = 'asset://' + getAssetByName(name).uuid;
return inst;
}
//# sourceMappingURL=utils.js.map
var Goods = (function (_super) {
tslib.__extends(Goods, _super);
......@@ -184,10 +179,12 @@
_this.player.anchorX = _this.player.width / 2;
_this.player.x = 375 - _this.player.width / 2;
_this.player.y = props.playerPositionY;
_this.stoneSvga.x = _this.player.width / 2 - _this.stoneSvga.width / 2;
_this.stoneSvga.y = 110;
_this.waterSvga.x = _this.player.width / 2 - _this.waterSvga.width / 2;
_this.waterSvga.y = 110;
_this.stoneSvga.x = _this.player.width / 2 - _this.stoneSvga.width / 2 + props.boomPosition1Offset[0];
_this.stoneSvga.y = _this.player.height / 2 - _this.stoneSvga.height / 2 + props.boomPosition1Offset[1];
_this.waterSvga.x = _this.player.width / 2 - _this.waterSvga.width / 2 + props.boomPosition2Offset[0];
_this.waterSvga.y = _this.player.height / 2 - _this.waterSvga.height / 2 + props.boomPosition2Offset[1];
_this.boomSvga.x = _this.player.width / 2 - _this.boomSvga.width / 2 + props.boomPosition3Offset[0];
_this.boomSvga.y = _this.player.height / 2 - _this.boomSvga.height / 2 + props.boomPosition3Offset[1];
}, 300);
this.rectBg = new engine.Container();
this.rectBg.alpha = 0;
......@@ -329,11 +326,17 @@
};
GameView.prototype.hasHit = function (a, b) {
var playerH = a.height;
var playerW = a.width;
var playerX = a.x;
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
if (props.playerWidth) {
playerW = props.playerWidth;
playerX = a.x + (a.width - props.playerWidth) / 2;
}
if (Math.abs((playerX + playerW / 2) - (b.x + b.width / 2)) < playerW / 2 + b.width / 2
&&
Math.abs((a.y + playerH / 1.3) - (b.y + b.height / 2)) < playerH / 2 + b.height / 2) {
return true;
......@@ -344,6 +347,7 @@
};
return GameView;
}(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super);
......
This diff is collapsed.
......@@ -31,7 +31,12 @@
"playerHeight": {
"alias": "玩家高度",
"type": "number",
"default": 50
"default": 100
},
"playerWidth": {
"alias": "玩家宽度",
"type": "number",
"default": 100
},
"maxStageBound": {
"alias": "最大移动边距",
......@@ -43,16 +48,27 @@
"alias": "游戏结束条件(1:接到炸弹死亡,2:分数负数或接到炸弹死亡)",
"type": "number",
"default": 1
},
"boomPosition1Offset": {
"alias": "爆炸svga位置偏移[x,y]",
"type": "array<number>",
"default": "0,0"
}
,
"boomPosition2Offset": {
"alias": "爆炸svga位置偏移[x,y]",
"type": "array<number>",
"default": "0,0"
}
,
"boomPosition3Offset": {
"alias": "爆炸svga位置偏移[x,y]",
"type": "array<number>",
"default": "-100,-100"
}
},
"assets": [
{
"name": "玩家icon",
"url": "//yun.duiba.com.cn/aurora/assets/50a7212a113175fa18c866b005d98f07c558dc77.png",
"uuid": "66f23d13-82a5-4cec-9496-301ec240d087",
"ext": ".png"
},
{
"name": "雨滴0",
"url": "//yun.duiba.com.cn/aurora/assets/badb3627bbcc75276a3eed53daa8b0a454ced6eb.png",
......@@ -101,12 +117,6 @@
"uuid": "d7a3947b-7fcb-48f2-9ddf-2f075d37a619",
"ext": ".svga"
},
{
"name": "炸弹",
"url": "//yun.duiba.com.cn/aurora/assets/3b58e7ace031b09c651cf8e7202f9c86e86852c9.svga",
"uuid": "d7a3947b-7fcb-48f2-9ddf-2f075d37a619",
"ext": ".svga"
},
{
"name": "玩家",
"url": "//yun.duiba.com.cn/aurora/assets/db0130d36ef79865be9c753ea0627027f16341d8.png",
......
......@@ -85,6 +85,9 @@ export default class GameView extends engine.Container {
this.player.addChild(this.waterSvga);
this.player.addChild(this.boomSvga);
// this.playerSvga.gotoAndPlay(1);
this.waterSvga.visible = false
this.stoneSvga.visible = false
this.boomSvga.visible = false
......@@ -97,10 +100,25 @@ export default class GameView extends engine.Container {
this.player.x = 375 - this.player.width / 2;
this.player.y = props.playerPositionY;
this.stoneSvga.x = this.player.width / 2 - this.stoneSvga.width/2;
this.stoneSvga.y = 110;
this.waterSvga.x = this.player.width / 2 - this.waterSvga.width/2;
this.waterSvga.y = 110;
this.stoneSvga.x = this.player.width / 2 - this.stoneSvga.width/2 + props.boomPosition1Offset[0];
this.stoneSvga.y = this.player.height / 2 - this.stoneSvga.height/2 + props.boomPosition1Offset[1];
this.waterSvga.x = this.player.width / 2 - this.waterSvga.width/2+ props.boomPosition2Offset[0];
this.waterSvga.y = this.player.height / 2 - this.waterSvga.height/2 + props.boomPosition2Offset[1];
this.boomSvga.x = this.player.width / 2 - this.boomSvga.width/2+ props.boomPosition3Offset[0];
this.boomSvga.y = this.player.height / 2 - this.boomSvga.height/2 + props.boomPosition3Offset[1];
// this.stoneSvga.x=props.boomPositionOffset[0]
// this.stoneSvga.y=props.boomPositionOffset[1]
// this.waterSvga.x=props.boomPositionOffset[0]
// this.waterSvga.y=props.boomPositionOffset[1]
// this.boomSvga.x=props.boomPositionOffset[0]
// this.boomSvga.y=props.boomPositionOffset[1]
},300)
......@@ -299,12 +317,19 @@ export default class GameView extends engine.Container {
private hasHit(a, b) {
let playerH=a.height
let playerW=a.width
let playerX=a.x
console.log("props",props.playerHeight)
if(props.playerHeight){
playerH=props.playerHeight
}
if(props.playerWidth){
playerW=props.playerWidth
playerX=a.x+(a.width-props.playerWidth)/2
}
if (
Math.abs((a.x + a.width / 2) - (b.x + b.width / 2)) < a.width / 2 + b.width / 2
Math.abs((playerX + playerW / 2) - (b.x + b.width / 2)) < playerW / 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 + playerH / 1.3 ) - (b.y + b.height / 2)) < playerH / 2 + b.height / 2
......
......@@ -7,15 +7,14 @@ export function getTexture(uuid) {
}
export function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid);
return engine.Texture.from(getAssetByName(name).uuid);
}
export function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, {keep: true});
engine.playSound(getAssetByName(name).uuid, {keep: true});
}
export function createSvga(name, anchorName?) {
console.log()
let inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid;
inst.source = 'asset://' + getAssetByName(name).uuid;
return inst;
}
\ No newline at end of file
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