Commit 8598e278 authored by wildfirecode13's avatar wildfirecode13

init

parent f54eb3b9
...@@ -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) {
......
...@@ -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)
......
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
...@@ -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)
......
...@@ -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
...@@ -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
...@@ -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);
......
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