Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // Creating variables
  2. var myX = 300 , myY = 300
  3. function update() {
  4. if(areColliding(myX,myY,30,30,mouseX,mouseY,30,30)){
  5. myX=Math.floor(Math.random()*600)
  6. myY=Math.floor(Math.random()*570)
  7. }
  8. }
  9. function draw() {
  10. context.fillRect(myX,myY,30,30)
  11. // This is how you draw a rectangle
  12. }
  13. function keyup (key) {
  14. // Show the pressed keycode in the console
  15. console.log("Pressed", key);
  16. };
  17.  
  18. function mouseup() {
  19. // Show coordinates of mouse on click
  20. console.log("Mouse clicked at", mouseX, mouseY);
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement