Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-stydy
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
谌继荃
game-stydy
Commits
26bf25a0
Commit
26bf25a0
authored
Dec 02, 2021
by
谌继荃
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏道具(全屏炸弹)
parent
91210898
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
26 deletions
+24
-26
MovableManager.ts
src/lib/MovableManager.ts
+12
-20
addGame.ts
src/planewar/addGame.ts
+5
-0
Boom.ts
src/tools/Boom.ts
+6
-5
Score.ts
src/tools/Score.ts
+1
-1
No files found.
src/lib/MovableManager.ts
View file @
26bf25a0
...
...
@@ -42,7 +42,6 @@ export default class MovableManager extends FYGE.EventDispatcher {
this
.
checkHitEnemy
();
this
.
checkHitByBullet
();
this
.
checkHitByEnemy
();
// window.addEventListener("Boom", this.checkAll);
// console.log('移动对象的数量:', this._movableList.length)
};
...
...
@@ -68,7 +67,7 @@ export default class MovableManager extends FYGE.EventDispatcher {
private
addScore
()
{
this
.
Score
+=
10
;
console
.
log
(
"this.Score"
,
this
.
Score
);
//
console.log("this.Score", this.Score);
scoreClass
.
change
(
this
.
Score
);
}
...
...
@@ -90,11 +89,11 @@ export default class MovableManager extends FYGE.EventDispatcher {
// console.log("x", x);
// console.log("y", y);
if
(
x
<
0
)
{
console
.
log
(
"x < 0"
);
//
console.log("x < 0");
this
.
hero
.
x
=
0
;
}
else
if
(
x
>
wW
-
dx
)
{
console
.
log
(
"x > wW"
);
//
console.log("x > wW");
this
.
hero
.
x
=
wW
-
dx
;
}
...
...
@@ -106,7 +105,7 @@ export default class MovableManager extends FYGE.EventDispatcher {
}
/**
* 鼠标点到的差值
移动要减去这个差值,不然会瞬间偏移
* 鼠标点到的差值
* @type {{x: number, y: number}}
*/
mouseDP
=
{
x
:
0
,
y
:
0
};
...
...
@@ -120,22 +119,20 @@ export default class MovableManager extends FYGE.EventDispatcher {
case
FYGE
.
MouseEvent
.
MOUSE_DOWN
:
this
.
mouseDP
.
x
=
e
.
localX
-
this
.
hero
.
x
;
this
.
mouseDP
.
y
=
e
.
localY
-
this
.
hero
.
y
;
console
.
log
(
"MOUSE_DOWN"
);
console
.
log
(
"mouseDP"
,
this
.
mouseDP
);
//
console.log("MOUSE_DOWN");
//
console.log("mouseDP", this.mouseDP);
break
;
case
FYGE
.
MouseEvent
.
MOUSE_UP
:
console
.
log
(
"MOUSE_UP"
);
//
console.log("MOUSE_UP");
case
FYGE
.
MouseEvent
.
MOUSE_MOVE
:
console
.
log
(
"MOUSE_MOVE"
);
//
console.log("MOUSE_MOVE");
const
px
=
e
.
localX
-
this
.
mouseDP
.
x
;
const
py
=
e
.
localY
-
this
.
mouseDP
.
y
;
console
.
log
(
"px"
,
px
);
console
.
log
(
"py"
,
py
);
// this.hero.position.set(px, py);
// console.log("px", px);
// console.log("py", py);
this
.
judgeEdge
();
break
;
}
...
...
@@ -175,10 +172,9 @@ export default class MovableManager extends FYGE.EventDispatcher {
}
checkAll
()
{
console
.
log
(
" this._movableList"
,
this
.
_movableList
);
const
enemyAllList
=
this
.
_movableList
.
filter
((
i
)
=>
i
instanceof
Enemy
);
enemyAllList
.
forEach
((
item
)
=>
{
this
.
remove
(
item
);
enemyAllList
.
forEach
((
enemy
)
=>
{
this
.
remove
(
enemy
);
console
.
log
(
"全屏爆炸"
);
});
}
...
...
@@ -231,10 +227,6 @@ export default class MovableManager extends FYGE.EventDispatcher {
return
;
}
}
// setTimeout(() => {
// this.checkAll();
// }, 3000);
}
private
step
()
{
...
...
src/planewar/addGame.ts
View file @
26bf25a0
...
...
@@ -34,9 +34,14 @@ export function addGame(stage: FYGE.Stage) {
this
.
pause
=
true
;
dragDropManager
.
remove
(
hero
);
pause
.
destroy
(
stage
);
boom
.
destroy
(
stage
);
enemyFactory
.
destroy
();
movableManager
.
destroy
();
}
function
boomAll
()
{
movableManager
.
checkAll
();
}
movableManager
.
addEventListener
(
"gameover"
,
onGamOver
);
stage
.
addEventListener
(
"Boom"
,
boomAll
);
}
src/tools/Boom.ts
View file @
26bf25a0
let
BoomText
;
export
default
class
Boom
{
private
_stage
:
FYGE
.
Stage
;
constructor
(
stage
:
FYGE
.
Stage
)
{
this
.
_stage
=
stage
;
BoomText
=
new
FYGE
.
TextField
();
BoomText
.
text
=
"
爆炸
"
;
BoomText
.
text
=
"
全屏炸弹
"
;
BoomText
.
fillColor
=
"#000000"
;
BoomText
.
size
=
50
;
BoomText
.
x
=
5
0
;
BoomText
.
x
=
2
0
;
BoomText
.
y
=
130
;
stage
.
addChildAt
(
BoomText
,
stage
.
children
.
length
-
1
);
...
...
@@ -15,8 +17,7 @@ export default class Boom {
Boom
()
{
console
.
log
(
"爆炸"
);
// 目前点击一次不能点击了
window
.
dispatchEvent
(
new
Event
(
"Boom"
));
this
.
_stage
.
dispatchEvent
(
"Boom"
);
}
reset
()
{}
...
...
src/tools/Score.ts
View file @
26bf25a0
...
...
@@ -14,7 +14,7 @@ export default class Score {
change
(
changeScore
)
{
score
=
changeScore
;
scoreText
.
text
=
`当前分数:
${
score
}
`
;
console
.
log
(
"change---scoreText.text"
,
scoreText
.
text
);
//
console.log("change---scoreText.text", scoreText.text);
}
reset
()
{}
...
...
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