This commit is contained in:
2024-09-19 08:39:56 +08:00
parent 01ad8b619e
commit 684ef1619d
10 changed files with 791 additions and 691 deletions

View File

@@ -55,20 +55,20 @@ export class SingletonModuleComp extends ecs.Comp {
monsters_dead:any = []
heros_dead:any = []
hero_pos:any=[
{x:-320,y:70},
{x:-320,y:0},
{x:-320,y:-70},
{x:-320,y:0},
{x:-320,y:0},
{x:-320,y:0},
{x:-320,y:BoxSet.GAME_LINE+70},
{x:-320,y:BoxSet.GAME_LINE},
{x:-320,y:BoxSet.GAME_LINE-70},
{x:-320,y:BoxSet.GAME_LINE},
{x:-320,y:BoxSet.GAME_LINE},
{x:-320,y:BoxSet.GAME_LINE},
]
enemy_pos:any =[
{x:320,y:70},
{x:320,y:0},
{x:320,y:-70},
{x:320,y:0},
{x:320,y:0},
{x:320,y:0},
{x:320,y:BoxSet.GAME_LINE+70},
{x:320,y:BoxSet.GAME_LINE},
{x:320,y:BoxSet.GAME_LINE-70},
{x:320,y:BoxSet.GAME_LINE},
{x:320,y:BoxSet.GAME_LINE},
{x:320,y:BoxSet.GAME_LINE},
]
vm_data: any = {
name : "纸片精灵大乱斗",

View File

@@ -197,7 +197,7 @@ export class HeroViewComp extends CCComp {
if(this.stop_cd > 0){
return
}
if (this.node.position.x >= 250-this.atk_dis) {
if (this.node.position.x >= 250-this.atk_dis/2) {
return;
}
// if(this.enemy){
@@ -244,16 +244,14 @@ export class HeroViewComp extends CCComp {
let pos =this.skill_pos()
let t_pos:Vec3 = v3(720,0)
if(this.enemy){
t_pos = v3(this.enemy.x-this.node.position.x,this.enemy.y-(this.node.position.y+pos.y))
t_pos = v3(this.enemy.x-this.node.position.x,this.enemy.y-this.node.position.y)
}
console.log("get_hero_pos",this.enemy,this.node.position,t_pos);
return {pos,t_pos}
}
get_hero_pos(hero:any){
let pos =this.skill_pos()
let t_pos:Vec3 = v3(720,0)
if(!hero.HeroView.node.isValid){
console.log("hero.heroView.node.isValid",hero.HeroView);
return
}else{
t_pos = v3(hero.HeroView.node.position.x-this.node.position.x,hero.HeroView.node.position.y-(this.node.position.y+pos.y))
@@ -443,7 +441,7 @@ export class HeroViewComp extends CCComp {
this.scheduleOnce(() => {
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
}, 0.3);
console.log(this.buff_atks)
// console.log(this.buff_atks)
}
check_buff_atks(dt: number){

View File

@@ -40,7 +40,6 @@ export class MapMonsterComp extends CCComp {
hero_start_ys:any[] = [35,-35];
mon_index:number = 0
hero_index:number = 0
line:number=BoxSet.GAME_LINE
onLoad(){
// 监听全局事件
oops.message.on("other_add_monster", this.on_other_add_monster, this);
@@ -94,15 +93,15 @@ export class MapMonsterComp extends CCComp {
for(let i=0;i<monsters.length;i++){
if(monsters[i].MonView == undefined) return
let mon:any = monsters[i].MonView.node.position
if(mon.x < x&&mon.y == (this.line +70)){
if(mon.x < x&&mon.y == smc.enemy_pos[0].y){
x = mon.x
continue
}
if(mon.x < x1&&mon.y == this.line){
if(mon.x < x1&&mon.y == smc.enemy_pos[1].y){
x1 = mon.x
continue
}
if(mon.x < x2&&mon.y == (this.line -70)){
if(mon.x < x2&&mon.y == smc.enemy_pos[2].y){
x2 = mon.x
continue
}
@@ -119,15 +118,15 @@ export class MapMonsterComp extends CCComp {
for(let i=0;i<heros.length;i++){
if(heros[i].HeroView == undefined) return
let ho:any = heros[i].HeroView.node.position
if(ho.x > x&&ho.y == (this.line +70)){
if(ho.x > x&&ho.y == smc.hero_pos[0].y){
x = ho.x
continue
}
if(ho.x > x1&&ho.y == this.line ){
if(ho.x > x1&&ho.y == smc.hero_pos[1].y ){
x1 = ho.x
continue
}
if(ho.x > x2&&ho.y == (this.line -70)){
if(ho.x > x2&&ho.y == smc.hero_pos[2].y){
x2 = ho.x
continue
}
@@ -150,7 +149,7 @@ export class MapMonsterComp extends CCComp {
private addHero(uuid:number=1001) {
let hero = ecs.getEntity<Hero>(Hero);
var scene = smc.map.MapView.scene;
let pos:Vec3 = v3(-280,BoxSet.GAME_LINE+this.start_ys[2]);
let pos:Vec3 = v3(-280,BoxSet.GAME_LINE+this.start_ys[this.hero_index]);
let monster_layer = scene.entityLayer!.node!
let scale = 1
hero.load(pos,scale,uuid,monster_layer);