Commit f2407cef authored by wildfirecode13's avatar wildfirecode13

init

parent 3442846d
......@@ -15,6 +15,11 @@ export default class Enemy extends Movable implements IWeaponHost {
this.texture = FYGE.Texture.fromUrl('//yun.duiba.com.cn/spark/assets/enemy2_fly1.0f4acd3728e90763d98a7328a5a32dbc78ec204e.png')
const weapon = new Weapon(this);
this.addEventListener(FYGE.Event.REMOVED_FROM_STAGE, () => {
console.log('敌人消失了')
weapon.destroy();
})
}
getShootVelocity() { return new Vector2(0, 4) }
......
......@@ -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) {
......@@ -27,8 +27,8 @@ export default class MovableManager {
const item = this._movableList[index];
if (this.calcCanRemove(item)) {
this._movableList.splice(index, 1);
item.parent && item.parent.removeChild(item);
index--;
item.destroy();
}
}
}
......
......@@ -14,7 +14,7 @@ export function addGame(stage: FYGE.Stage) {
const enemy = stage.addChild(new Enemy(movableManager));
enemy.position.set(0, 0);
enemy.velocity=new Vector2(1,1);
enemy.velocity=new Vector2(4,1);
dragDropManager.add(hero);
}
\ No newline at end of file
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