diff --git a/assets/resources/game/heros/heath.prefab b/assets/resources/game/heros/heath.prefab index 3714e423..69642214 100644 --- a/assets/resources/game/heros/heath.prefab +++ b/assets/resources/game/heros/heath.prefab @@ -289,8 +289,8 @@ }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0.53125, - "y": 0.53125 + "x": 0.5, + "y": 0.5 }, "_id": "" }, @@ -701,8 +701,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 100, - "height": 100 + "width": 60, + "height": 60 }, "_anchorPoint": { "__type__": "cc.Vec2", diff --git a/assets/script/game/monster/Monster.ts b/assets/script/game/monster/Monster.ts index eb247ee2..39e36d69 100644 --- a/assets/script/game/monster/Monster.ts +++ b/assets/script/game/monster/Monster.ts @@ -22,7 +22,7 @@ export class Monster extends ecs.Entity { MonsterModel!: MonsterModelComp; // 视图层 MonsterView!: MonsterViewComp; - MoveToComp!: MoveToComp; // 移动 + RoleMoveTo!: MoveToComp; // 移动 protected init() { this.addComponents( @@ -46,7 +46,9 @@ export class Monster extends ecs.Entity { node.setPosition(pos) var mv = node.getComponent(MonsterViewComp)!; - + mv.speed = speed; + mv.ospeed = speed; + mv.Tpos = v3(0,0,0); this.add(mv); smc.monsters_in.push({name:mv.ent.name,eid:mv.ent.eid,pos_x:0}), // node.setScale(-1, 1, 1); diff --git a/assets/script/game/monster/MonsterViewComp.ts b/assets/script/game/monster/MonsterViewComp.ts index a44509f7..49d5eca9 100644 --- a/assets/script/game/monster/MonsterViewComp.ts +++ b/assets/script/game/monster/MonsterViewComp.ts @@ -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; } });