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
8598e278
Commit
8598e278
authored
Nov 20, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
f54eb3b9
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
10 deletions
+24
-10
MovableManager.ts
src/lib/MovableManager.ts
+1
-1
Enemy.ts
src/planewar/Enemy.ts
+3
-1
EnemyFactory.ts
src/planewar/EnemyFactory.ts
+14
-0
Hero.ts
src/planewar/Hero.ts
+2
-2
addGame.ts
src/planewar/addGame.ts
+2
-2
IWeaponHost.ts
src/weapon/IWeaponHost.ts
+1
-0
Weapon.ts
src/weapon/Weapon.ts
+1
-4
No files found.
src/lib/MovableManager.ts
View file @
8598e278
...
@@ -11,7 +11,7 @@ export default class MovableManager {
...
@@ -11,7 +11,7 @@ export default class MovableManager {
onEnterFrame
=
()
=>
{
onEnterFrame
=
()
=>
{
this
.
step
();
this
.
step
();
this
.
checkRemove
();
this
.
checkRemove
();
console
.
log
(
'移动对象的数量:'
,
this
.
_movableList
.
length
)
//
console.log('移动对象的数量:',this._movableList.length)
}
}
private
calcCanRemove
(
item
:
FYGE
.
DisplayObject
)
{
private
calcCanRemove
(
item
:
FYGE
.
DisplayObject
)
{
...
...
src/planewar/Enemy.ts
View file @
8598e278
...
@@ -23,7 +23,9 @@ export default class Enemy extends Movable implements IWeaponHost {
...
@@ -23,7 +23,9 @@ export default class Enemy extends Movable implements IWeaponHost {
})
})
}
}
getShootVelocity
()
{
return
new
Vector2
(
0
,
4
)
}
getShootInterval
(){
return
100
}
getShootVelocity
()
{
return
new
Vector2
(
0
,
10
)
}
getShootPoint
()
{
getShootPoint
()
{
return
new
FYGE
.
Point
(
this
.
x
+
this
.
width
/
2
,
this
.
y
+
this
.
height
)
return
new
FYGE
.
Point
(
this
.
x
+
this
.
width
/
2
,
this
.
y
+
this
.
height
)
...
...
src/planewar/EnemyFactory.ts
0 → 100644
View file @
8598e278
export
default
class
EnemyFactory
{
private
_timer
;
constructor
()
{
this
.
_timer
=
setInterval
(
this
.
onTimer
,
10
*
1000
)
}
onTimer
=
()
=>
{
}
destroy
()
{
clearInterval
(
this
.
_timer
);
}
}
\ No newline at end of file
src/planewar/Hero.ts
View file @
8598e278
...
@@ -16,8 +16,8 @@ export default class Hero extends DragDropable implements IWeaponHost {
...
@@ -16,8 +16,8 @@ export default class Hero extends DragDropable implements IWeaponHost {
const
weapon
=
new
Weapon
(
this
);
const
weapon
=
new
Weapon
(
this
);
}
}
getShootInterval
(){
return
10
}
getShootVelocity
(){
return
new
Vector2
(
0
,
-
4
)}
getShootVelocity
(){
return
new
Vector2
(
0
,
-
8
)}
getShootPoint
()
{
getShootPoint
()
{
return
new
FYGE
.
Point
(
this
.
x
+
this
.
width
/
2
,
this
.
y
)
return
new
FYGE
.
Point
(
this
.
x
+
this
.
width
/
2
,
this
.
y
)
...
...
src/planewar/addGame.ts
View file @
8598e278
...
@@ -15,7 +15,7 @@ export function addGame(stage: FYGE.Stage) {
...
@@ -15,7 +15,7 @@ export function addGame(stage: FYGE.Stage) {
const
enemy
=
stage
.
addChild
(
new
Enemy
(
movableManager
));
const
enemy
=
stage
.
addChild
(
new
Enemy
(
movableManager
));
enemy
.
position
.
set
(
0
,
0
);
enemy
.
position
.
set
(
0
,
0
);
enemy
.
velocity
=
new
Vector2
(
4
,
1
);
enemy
.
velocity
=
new
Vector2
(
4
,
1
);
dragDropManager
.
add
(
hero
);
dragDropManager
.
add
(
hero
);
}
}
\ No newline at end of file
src/weapon/IWeaponHost.ts
View file @
8598e278
...
@@ -5,4 +5,5 @@ export interface IWeaponHost extends FYGE.Sprite {
...
@@ -5,4 +5,5 @@ export interface IWeaponHost extends FYGE.Sprite {
movableManager
:
MovableManager
;
movableManager
:
MovableManager
;
getShootPoint
():
FYGE
.
Point
;
getShootPoint
():
FYGE
.
Point
;
getShootVelocity
():
Vector2
;
getShootVelocity
():
Vector2
;
getShootInterval
();
}
}
\ No newline at end of file
src/weapon/Weapon.ts
View file @
8598e278
...
@@ -25,7 +25,7 @@ export default class Weapon {
...
@@ -25,7 +25,7 @@ export default class Weapon {
}
}
}
}
canCreateBullet
()
{
canCreateBullet
()
{
return
this
.
_count
>=
this
.
getShootInterval
();
return
this
.
_count
>=
this
.
_host
.
getShootInterval
();
}
}
createBullet
=
()
=>
{
createBullet
=
()
=>
{
...
@@ -37,9 +37,6 @@ export default class Weapon {
...
@@ -37,9 +37,6 @@ export default class Weapon {
this
.
_host
.
movableManager
.
add
(
bullet
);
this
.
_host
.
movableManager
.
add
(
bullet
);
}
}
getShootInterval
()
{
return
20
;
}
destroy
()
{
destroy
()
{
clearInterval
(
this
.
_timer
);
clearInterval
(
this
.
_timer
);
...
...
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