This commit is contained in:
2024-07-30 13:13:40 +08:00
parent d85ed9e6b6
commit 79c3a23f09
3 changed files with 12 additions and 7 deletions

View File

@@ -50,6 +50,7 @@ export class MonsterViewComp extends CCComp {
this.move(dt);
}
if(this.node.position.x < -300){
console.log(this.node,this.ent)
smc.monsters_in = smc.monsters_in.filter(element => element.eid !== this.ent.eid);
this.node.destroy();
}
@@ -60,8 +61,10 @@ export class MonsterViewComp extends CCComp {
this.node.setPosition(this.node.position.x-dt*this.speed, this.node.position.y, this.node.position.z);
}
update_pos(){
smc.monsters_in.forEach(element => {
smc.monsters_in.forEach((element,index) => {
if(element.eid == this.ent.eid){
console.log("index:"+index)
element.pos_x = this.node.position.x;
}
});