Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-libs
Commits
bb671d05
Commit
bb671d05
authored
Jun 13, 2020
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--
parent
cb8f7b3e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
62 deletions
+97
-62
food-fell2.json
dist/customs/food-fell2.json
+22
-14
context.d.ts
src/custom/context.d.ts
+2
-1
load-assets.js
src/custom/food-fell2/debug/load-assets.js
+0
-12
main.js
src/custom/food-fell2/debug/main.js
+16
-12
main.js.map
src/custom/food-fell2/debug/main.js.map
+1
-1
meta.json
src/custom/food-fell2/meta.json
+23
-13
GameView.ts
src/custom/food-fell2/src/game/GameView.ts
+30
-5
utils.ts
src/custom/food-fell2/src/game/utils.ts
+3
-4
No files found.
dist/customs/food-fell2.json
View file @
bb671d05
This diff is collapsed.
Click to expand it.
src/custom/context.d.ts
View file @
bb671d05
declare
function
getAssetByUUID
(
uuid
:
string
);
declare
function
getProps
():
any
;
declare
function
getAssetByName
(
name
:
string
);
declare
function
getProps
():
any
;
\ No newline at end of file
src/custom/food-fell2/debug/load-assets.js
View file @
bb671d05
...
...
@@ -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"
,
...
...
src/custom/food-fell2/debug/main.js
View file @
bb671d05
...
...
@@ -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
);
...
...
src/custom/food-fell2/debug/main.js.map
View file @
bb671d05
This diff is collapsed.
Click to expand it.
src/custom/food-fell2/meta.json
View file @
bb671d05
...
...
@@ -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"
,
...
...
src/custom/food-fell2/src/game/GameView.ts
View file @
bb671d05
...
...
@@ -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
...
...
src/custom/food-fell2/src/game/utils.ts
View file @
bb671d05
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment