This commit is contained in:
2024-09-25 17:23:56 +08:00
parent 3870bdec50
commit 5831697fb8
21 changed files with 155 additions and 93 deletions

View File

@@ -180,12 +180,13 @@ export class MonViewComp extends CCComp {
let dir = 320
this.enemy = v3(720,this.node.position.y)
for (let i = 0; i < GameSet.ATK_LINES; i++) {
let ho:any = smc.hero_pos[i];
let x=Math.abs(ho.x-this.node.position.x)
// console.log("check_enemy_alive,x:"+ho.x+"-"+this.node.position.x+"="+x);
let y = Math.abs(ho.y-this.node.position.y)
let squaredDistance =x*x+y*y
let distance = Math.sqrt(squaredDistance);
// console.log("check_enemy_alive,z:"+x+":"+y+":"+this.atk_dis+":"+distance);
if(distance < dir){
dir = distance
this.enemy = ho
@@ -193,10 +194,12 @@ export class MonViewComp extends CCComp {
}
if(dir < this.atk_dis){
if(dir < this.atk_cd-60) this.stop_cd = 0.1
this.is_atking=true
}else{
this.is_atking=false
}
// console.log("check_enemy_alive", this.enemy);
}
hp_show(){
if(this.hp == this.hp_max){
@@ -285,7 +288,7 @@ export class MonViewComp extends CCComp {
this.atk_time = 0;
this.as.atk();
this.scheduleOnce(()=>{
console.log("mon skill_cd:"+this.skill_uuid);
// console.log("mon skill_cd:"+this.skill_uuid);
this.shoot(this.skill_uuid);
},0.4)
}