class Panel{ constructor(x,y,width,height){ this.width=width; this.height=height; this.pos={ x: x, y: y }; } draw(){ ctx.drawImage($("#img_panel")[0],this.pos.x,this.pos.y,this.width,this.height); } } class Throttlelever{ constructor(panel,x,y,scale){ this.panel=panel; this.scale=scale; this.name="throttle lever"; this.desc="changes the power when teleporting"; this.handlescale=scale*1.6; this.pos={ x: setwidth/2-this.scale/2+x, y: setheight/2-this.scale/2+y }; this.min=(this.pos.y-(this.scale+80)/5).toFixed(2); this.max=(this.pos.y+(this.scale+80)/2.4).toFixed(2); this.handlepos={ x: setwidth/2-this.handlescale/2+x, y: this.max } this.mouseisdown=false; this.mouseisover=false; } draw(){ if(panelnum==this.panel){ if(this.handlepos.ythis.max){ this.handlepos.y=this.max; } if(power.ison==false){ this.handlepos.y=this.max } this.value=100-(((this.handlepos.y-this.pos.y+26).toFixed())/80*100).toFixed(); ctx.drawImage($("#img_throttle_base")[0],this.pos.x,this.pos.y,this.scale,this.scale+80); ctx.drawImage($("#img_throttle_handle")[0],this.handlepos.x,this.handlepos.y,this.handlescale,this.handlescale+20); if(power.ison==true){ ctx.fillStyle = "#0df"; ctx.font = "13px Ariel"; ctx.fillText(this.value,this.pos.x+15,this.pos.y+this.scale+72) } if(telepathicChover.ison==true&&this.mouseisover==true){ ctx.fillStyle = "#000"; ctx.globalAlpha = 0.8; ctx.fillRect(globalcx,globalcy,150,100) ctx.globalAlpha = 1; ctx.font = "15px Ariel"; ctx.fillStyle = "#fff"; ctx.fillText(this.name,globalcx+20,globalcy+20,149) ctx.font = "12px Ariel"; ctx.fillText(this.desc,globalcx,globalcy+40,149) } } } mouseon(cx,cy){ if(panelnum==this.panel){ if(cx>this.pos.x&&cxthis.pos.y&&cythis.pos.x&&cxthis.pos.y&&cythis.pos.x&&cxthis.pos.y&&cythis.pos.x&&cxthis.pos.y&&cythis.pos.x&&cxthis.pos.y&&cythis.pos.x&&cxthis.pos.y&&cythis.pos.y+(this.scale/3)&&cythis.pos.y+(this.scale/3*2)&&cythis.pos.x&&cxthis.pos.y&&cythis.pos.x&&cxthis.pos.y&&cy4)panelnum=1; } if(type=="down"){ panelnum--; if(panelnum<1)panelnum=4; } } } } class Flever{ constructor(panel,x,y,scale){ this.panel=panel; this.state="#img_flever"; this.scale=-120; this.name="flight lever" this.desc="allows you to move when flightmode is enabled" this.pos={ x: setwidth/2-(this.scale+260)/2+x, y: setheight/2-(this.scale+409)/2+y }; this.buttonpos={ x: ((this.pos.x+(this.scale+260)/2)-(this.scale+239)/2)+6, y: this.pos.y+(this.scale+409)-90 } this.mouseisover=false; this.mobilebuttons=false; } draw(){ if(panelnum==this.panel){ ctx.drawImage($(this.state)[0],this.pos.x,this.pos.y,this.scale+260,this.scale+409); if(this.mobilebuttons==true){ ctx.drawImage($("#img_flever_mobile")[0],this.buttonpos.x,this.buttonpos.y,this.scale+239,this.scale+191); } } } drawhover(){ if(telepathicChover.ison==true&&this.mouseisover==true){ ctx.fillStyle = "#000"; ctx.globalAlpha = 0.8; ctx.fillRect(globalcx,globalcy,160,100) ctx.globalAlpha = 1; ctx.font = "15px Ariel"; ctx.fillStyle = "#fff"; ctx.fillText(this.name,globalcx+20,globalcy+20,this.pos.y+this.scale) ctx.font = "12px Ariel"; ctx.fillText(this.desc,globalcx,globalcy+40,this.pos.y+this.scale+20) ctx.fillText("use arrow keys on keyboard",globalcx,globalcy+80,this.pos.y+this.scale) } } toggle(cx,cy){ if(panelnum==this.panel&&cx>this.pos.x&&cxthis.pos.y&&cy((this.buttonpos.x)+6)+(this.scale+227)/3&&cy>this.buttonpos.y&&cx<(((this.buttonpos.x)+6)+(this.scale+227)/3)+(this.scale+227)/3&&cy((this.buttonpos.x)+6)+(this.scale+227)/3&&cy>this.buttonpos.y+(this.scale+155)&&cx<(((this.buttonpos.x)+6)+(this.scale+227)/3)+(this.scale+227)/3&&cy((this.buttonpos.x)+6)&&cy>this.buttonpos.y+(this.scale+155)&&cx<(((this.buttonpos.x)+6)+(this.scale+227)/3)+(this.scale+227)/3&&cy((this.buttonpos.x)+6)+(this.scale+227)/1.5&&cy>this.buttonpos.y+(this.scale+155)&&cythis.pos.x&&cxthis.pos.y&&cy1){ var size=(this.height/1.8-0.5)/(this.text.length-0.5); } else { var size=(this.height/1.8-0.5)/1; } ctx.font = size+"px Ariel"; if(power.ison==true){ for(var i=0; i