mirror of
https://github.com/heav-4/apioform
synced 2024-10-31 19:06:15 +00:00
parity overlay
This commit is contained in:
parent
0a4a8fa56a
commit
63b2ac63d4
39
index.html
39
index.html
@ -13,6 +13,8 @@
|
||||
var kills=0;*/
|
||||
let frigidmode=false
|
||||
let paritychallenge=false
|
||||
let parityoverlay=false
|
||||
let prevkilled=false // parity challenge thingy.
|
||||
const solid={
|
||||
"player":true,
|
||||
"bee":true,
|
||||
@ -51,12 +53,8 @@
|
||||
this.meta=meta;
|
||||
this.cx=x;
|
||||
this.cy=y;
|
||||
if (this.type=="bee"||this.type=="apioform"||this.type=="apiodiagoform"||this.type=="apiokinetoform"||this.type=="apiopyroform"||this.type=="cryoapioform"){
|
||||
this.meta.clock=0;
|
||||
}
|
||||
if (this.type=="apiopyroform"||this.type=="cryoapioform"){
|
||||
this.meta.cooldown=0
|
||||
}
|
||||
this.meta.frozen=0
|
||||
}
|
||||
}
|
||||
@ -217,6 +215,16 @@
|
||||
case "player":
|
||||
ctx.fillStyle="#000000"
|
||||
ctx.fillRect(ent.cx*10,ent.cy*10,10,10)
|
||||
if (parityoverlay&&paritychallenge){
|
||||
ctx.fillStyle="#ffffff"
|
||||
ctx.textBaseline="middle"
|
||||
ctx.textAlign="center"
|
||||
ctx.font="10px monospace";
|
||||
if (ent.x%2==0&&ent.y%2==0) ctx.fillText("a",ent.cx*10+5,ent.cy*10+5)
|
||||
if (ent.x%2==1&&ent.y%2==0) ctx.fillText("b",ent.cx*10+5,ent.cy*10+5)
|
||||
if (ent.x%2==0&&ent.y%2==1) ctx.fillText("d",ent.cx*10+5,ent.cy*10+5)
|
||||
if (ent.x%2==1&&ent.y%2==1) ctx.fillText("c",ent.cx*10+5,ent.cy*10+5)
|
||||
}
|
||||
break;
|
||||
case "bee":
|
||||
if (ent.meta.clock%2==0) ctx.fillStyle="#808020"
|
||||
@ -247,6 +255,20 @@
|
||||
case "apiopariform":
|
||||
ctx.fillStyle="#808080"
|
||||
ctx.fillRect(ent.cx*10,ent.cy*10,10,10)
|
||||
if (parityoverlay&&paritychallenge){
|
||||
ctx.fillStyle="#ffffff"
|
||||
ctx.textBaseline="middle"
|
||||
ctx.textAlign="center"
|
||||
ctx.font="10px monospace";
|
||||
if (ent.x%2==0&&ent.y%2==0) ctx.fillText("a",ent.cx*10+5,ent.cy*10+5)
|
||||
if (ent.x%2==1&&ent.y%2==0) ctx.fillText("b",ent.cx*10+5,ent.cy*10+5)
|
||||
if (ent.x%2==0&&ent.y%2==1) ctx.fillText("d",ent.cx*10+5,ent.cy*10+5)
|
||||
if (ent.x%2==1&&ent.y%2==1) ctx.fillText("c",ent.cx*10+5,ent.cy*10+5)
|
||||
}
|
||||
break;
|
||||
case "apiocryokinetoform":
|
||||
ctx.fillStyle="#FFFFFF"
|
||||
ctx.fillRect(ent.cx*10,ent.cy*10,10,10)
|
||||
break;
|
||||
}
|
||||
ent.cx+=(ent.x-ent.cx)*0.4
|
||||
@ -340,11 +362,15 @@
|
||||
makeent(3,3,"player",{})
|
||||
px=3
|
||||
py=3
|
||||
prevkilled=false
|
||||
break;
|
||||
case 80:
|
||||
paritychallenge=!paritychallenge
|
||||
turn({keyCode:82})
|
||||
break;
|
||||
case 79:
|
||||
parityoverlay=!parityoverlay
|
||||
break;
|
||||
}
|
||||
if (px+dx<0||px+dx>49||py+dy<0||py+dy>49){
|
||||
maketurn=false
|
||||
@ -365,6 +391,7 @@
|
||||
for (var i=entities[nent].length-1;i>=0;i--){
|
||||
if (entities[nent][i].meta.dead!==undefined){
|
||||
entities[nent].splice(i,1)
|
||||
prevkilled=true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -577,6 +604,9 @@
|
||||
}
|
||||
}
|
||||
if (paritychallenge){
|
||||
if (prevkilled){
|
||||
prevkilled=false
|
||||
}else{
|
||||
while (true){
|
||||
let cx=Math.floor(Math.random()*48)+1
|
||||
let cy=Math.floor(Math.random()*48)+1
|
||||
@ -587,6 +617,7 @@
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (php<=0||px<0||px>49||py<0||py>49){
|
||||
for (i in entities[px+" "+py]){
|
||||
if (entities[px+" "+py][i].type=="player"){
|
||||
|
Loading…
Reference in New Issue
Block a user