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
cb8f7b3e
Commit
cb8f7b3e
authored
Jun 11, 2020
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--
parent
08bf8fe8
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
18 deletions
+53
-18
food-fell2.json
dist/customs/food-fell2.json
+13
-3
main.js
src/custom/food-fell2/debug/main.js
+12
-6
main.js.map
src/custom/food-fell2/debug/main.js.map
+1
-1
meta.json
src/custom/food-fell2/meta.json
+14
-2
GameView.ts
src/custom/food-fell2/src/game/GameView.ts
+13
-6
No files found.
dist/customs/food-fell2.json
View file @
cb8f7b3e
This diff is collapsed.
Click to expand it.
src/custom/food-fell2/debug/main.js
View file @
cb8f7b3e
...
...
@@ -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
);
...
...
src/custom/food-fell2/debug/main.js.map
View file @
cb8f7b3e
This diff is collapsed.
Click to expand it.
src/custom/food-fell2/meta.json
View file @
cb8f7b3e
{
"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"
,
...
...
src/custom/food-fell2/src/game/GameView.ts
View file @
cb8f7b3e
...
...
@@ -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
}
...
...
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