improvements Cyst_Kid
This commit is contained in:
@@ -67,14 +67,12 @@ _movePl(wantDir){
|
||||
p.gc = COLS-1; p.x = p.gc*TILE;
|
||||
p.gr = T_ROW; p.y = T_ROW*TILE+HUD_TOP;
|
||||
p.moving = false;
|
||||
this._onTun();
|
||||
return;
|
||||
}
|
||||
if(p.gc >= COLS){
|
||||
p.gc = 0; p.x = 0;
|
||||
p.gr = T_ROW; p.y = T_ROW*TILE+HUD_TOP;
|
||||
p.moving = false;
|
||||
this._onTun();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -113,42 +111,18 @@ _movePl(wantDir){
|
||||
}
|
||||
|
||||
// Eat dots
|
||||
for(const d of this.dots)if(!d.e&&d.r===p.gr&&d.c===p.gc){d.e=true;this.eDots++;this.lsc++;if(this.fr%4===0)this.snd.bite()}
|
||||
// Eat cystine
|
||||
for(const cs of this.cysts)if(cs.v&&!cs.e&&cs.r===p.gr&&cs.c===p.gc){
|
||||
cs.e=true;cs.v=false;this.ateSt=true;this.lsc+=10;this.snd.laser();
|
||||
this.fx.push({x:p.x+TILE/2,y:p.y+TILE/2,co:'#FFD700',t:30,mx:30,tp:'glow'});
|
||||
this.cysts.forEach(x=>{if(!x.e)x.v=false});this._sBio();
|
||||
}
|
||||
// Eat bio
|
||||
for(let i=this.bios.length-1;i>=0;i--){const b=this.bios[i];if(b.r===p.gr&&b.c===p.gc){
|
||||
this.bios.splice(i,1);this.ateBi=true;this.lsc+=10;this.snd.laser();
|
||||
this.fx.push({x:p.x+TILE/2,y:p.y+TILE/2,co:'#FFD700',t:30,mx:30,tp:'glow'});
|
||||
}}
|
||||
},
|
||||
|
||||
_onTun(){
|
||||
if(this.ateSt&&this.ateBi&&!this.sup){
|
||||
this._sSup();this.ateSt=false;this.ateBi=false;this.combD++;this.lsc+=20;
|
||||
for(const d of this.dots)if(!d.e&&d.r===p.gr&&d.c===p.gc){d.e=true;this.eDots++;this.lsc+=SC_DOT;if(this.fr%4===0)this.snd.bite()}
|
||||
// Pick up med
|
||||
if(!this.hasMed){for(const m of this.meds){if(!m.eaten&&m.r===p.gr&&m.c===p.gc){
|
||||
m.eaten=true;this.hasMed=true;this.snd.laser();
|
||||
this.fx.push({x:p.x+TILE/2,y:p.y+TILE/2,co:'#EC4899',t:30,mx:30,tp:'glow'});
|
||||
}}}
|
||||
// Deliver med to patient
|
||||
if(this.hasMed&&this.patient&&p.gr===this.patient.r&&p.gc===this.patient.c){
|
||||
this._succChall();
|
||||
}
|
||||
},
|
||||
|
||||
_sBio(){
|
||||
const cs=[];for(let r=1;r<ROWS-1;r++)for(let c=1;c<COLS-1;c++)if(isPath(r,c)&&Math.abs(r-this.pl.gr)+Math.abs(c-this.pl.gc)>5)cs.push({r,c});
|
||||
if(cs.length)this.bios.push(cs[0|Math.random()*cs.length]);
|
||||
},
|
||||
|
||||
_sSup(){
|
||||
this.sup=true;this.supT=SUPER_SEC*FPS;this.snd.laser();
|
||||
this.pains.forEach(p=>p.scared=true);
|
||||
this.fx.push({x:this.pl.x+TILE/2,y:this.pl.y+TILE/2,co:CO.sup,t:40,mx:40,tp:'glow'});
|
||||
},
|
||||
|
||||
_esup(){
|
||||
this.sup=false;
|
||||
PH.forEach((h,i)=>{const p=this.pains[i];p.scared=false;p.eaten=false;p.inHouse=true;p.leaving=false;p.x=h.c*TILE;p.y=h.r*TILE+HUD_TOP;p.gc=h.c;p.gr=h.r;p.relT=i*60+30;p.moving=false});
|
||||
if(this.combD<this.combN){const rem=this.cysts.filter(c=>!c.e);const pos=this._rp(rem.length,1,20);rem.forEach((cs,i)=>{if(pos[i]){cs.r=pos[i].r;cs.c=pos[i].c;cs.v=true}})}
|
||||
},
|
||||
|
||||
// -------- PAIN MOVEMENT --------
|
||||
_movePains(){
|
||||
@@ -179,7 +153,7 @@ _movePains(){
|
||||
}
|
||||
|
||||
// Normal movement using the entity system
|
||||
const spd=p.scared?p.spd*.55:p.spd;
|
||||
const spd=p.scared?p.spd*GHOST_SCARED_MULT:p.spd;
|
||||
|
||||
this._moveEntity(p, spd, (ent)=>{
|
||||
const valid=DIRS.filter(d=>{
|
||||
|
||||
Reference in New Issue
Block a user