daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var myX = 120, myY = 170;
  2. var kvadratX = 100 , kvadratY = 150;
  3. var kvadrat2X = 198 , kvadrat2Y = 310;
  4. var kvadrat3X = 235 , kvadrat3Y = 180;
  5. var kvadrat4X = 500 , kvadrat4Y = 149;
  6. var deads = 0;
  7. var posoka1 = 1, posoka2 = 2 , posoka3 = 1 , posoka4 = 2;
  8. var speed = 2.5;
  9. var pobedi = false;
  10. function prerajdane(){
  11.     myX = 120;
  12.     myY = 170;
  13.     deads ++;
  14. }
  15.  
  16. function update() {
  17.     if(isKeyPressed[39]) myX+=1.5;
  18.     if(isKeyPressed[37]) myX-=1.5
  19.     if(isKeyPressed[40]) myY+=1.5;
  20.     if(isKeyPressed[38]) myY-=1.5;
  21.    
  22.     if(!isKeyPressed[39]){
  23.         if(!isKeyPressed[37]){
  24.             if(!isKeyPressed[40]){
  25.                 if(!isKeyPressed[38]){  
  26.                     if(isKeyPressed[68]) myX+=1.5;
  27.                     if(isKeyPressed[65]) myX-=1.5
  28.                     if(isKeyPressed[83]) myY+=1.5;
  29.                     if(isKeyPressed[87]) myY-=1.5;
  30.                 }
  31.             }
  32.         }
  33.     }
  34.     if(myX < 101) myX = 101
  35.     if(myY > 329) myY = 329
  36.     if(myY < 150) myY = 150
  37.     if(myX > 180 && myX < 230 && myY < 310) myX = 180
  38.     if(myX < 235 && myY < 310 && myX > 200) myX = 235;
  39.     if(myY < 313 && myX >  200 && myX < 235) myY = 313
  40.     if(myX > 270 && myX < 535 && myY > 290) myY = 290
  41.     if(myX > 235 && myX < 500 && myY < 180) myY = 180;
  42.     if(myX > 580) myX = 580;
  43.     if(myX > 248 && myY >= 290 && myX < 280) myX = 248;
  44.     if(myX > 512 && myY > 160) myX = 512;
  45.     if(myX > 500 && myY < 160) pobedi = true;
  46.  };
  47. function draw() {
  48.     context.fillStyle=" #6495ED "
  49.     context.fillRect(0,0,800,600);
  50.     context.fillStyle = " #80ff80 "
  51.     context.strokeRect(kvadrat3X , kvadrat3Y , 300 , 130);
  52.     context.strokeRect(kvadrat2X , kvadrat2Y , 70 , 40);
  53.     context.strokeRect(kvadratX , kvadratY , 100 , 200);
  54.     context.strokeRect(kvadrat4X , kvadrat4Y , 100 , 35);
  55.     context.fillRect(kvadratX , kvadratY , 100 , 200)
  56.     context.fillRect(kvadrat2X , kvadrat2Y , 70 , 40)
  57.     context.fillRect(kvadrat4X , kvadrat4Y , 100 , 35)
  58.     context.fillRect(kvadrat3X , kvadrat3Y , 300 , 130)
  59.     context.fillStyle="red"
  60.     context.fillRect(myX , myY , 20 , 20);
  61.     context.strokeStyle = "black"
  62.     context.font = "20px Verdana"
  63.     context.fillStyle = " purple "
  64.     context.fillText("Go here !" , 500 , 170)
  65.     context.lineWidth = "3"
  66.     context.strokeRect(myX , myY , 20 , 20);
  67.     context.font = "60px Verdana"
  68.     context.fillStyle = "black"
  69.     context.fillText("Deads : " + deads , 430 , 65)
  70.     if(pobedi){
  71.         context.fillStyle = " yellow "
  72.         context.fillRect(0 , 0 , 800 , 600);
  73.         context.font = "150px Verdana"
  74.         context.fillStyle = "black"
  75.         context.fillText("You win !!!" , 0 , 150)
  76.         context.fillStyle = "black"
  77.         context.font = "30px Verdana"
  78.         context.fillText("Developed by Maxim Hristov" , 10 , 590)
  79.     }
  80. };
  81.  
  82. function keyup(key) {
  83.     console.log("Pressed", key);
  84. };
  85.  
  86. function mouseup() {
  87.     console.log("Mouse clicked at", mouseX,mouseY);  
  88. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top