Commit 8598e278 authored by wildfirecode13's avatar wildfirecode13

init

parent f54eb3b9
......@@ -11,7 +11,7 @@ export default class MovableManager {
onEnterFrame = () => {
this.step();
this.checkRemove();
console.log('移动对象的数量:',this._movableList.length)
// console.log('移动对象的数量:',this._movableList.length)
}
private calcCanRemove(item: FYGE.DisplayObject) {
......
......@@ -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() {
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 {
const weapon = new Weapon(this);
}
getShootVelocity(){return new Vector2(0, -4)}
getShootInterval(){return 10}
getShootVelocity(){return new Vector2(0, -8)}
getShootPoint() {
return new FYGE.Point(this.x + this.width / 2, this.y)
......
......@@ -15,7 +15,7 @@ export function addGame(stage: FYGE.Stage) {
const enemy = stage.addChild(new Enemy(movableManager));
enemy.position.set(0, 0);
enemy.velocity=new Vector2(4,1);
enemy.velocity = new Vector2(4, 1);
dragDropManager.add(hero);
}
\ No newline at end of file
......@@ -5,4 +5,5 @@ export interface IWeaponHost extends FYGE.Sprite {
movableManager: MovableManager;
getShootPoint(): FYGE.Point;
getShootVelocity(): Vector2;
getShootInterval();
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ export default class Weapon {
}
}
canCreateBullet() {
return this._count >= this.getShootInterval();
return this._count >= this._host.getShootInterval();
}
createBullet = () => {
......@@ -37,9 +37,6 @@ export default class Weapon {
this._host.movableManager.add(bullet);
}
getShootInterval() {
return 20;
}
destroy() {
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