Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Creating variables
- var myX = 300 , myY = 300
- function update() {
- if(areColliding(myX,myY,30,30,mouseX,mouseY,30,30)){
- myX=Math.floor(Math.random()*600)
- myY=Math.floor(Math.random()*570)
- }
- }
- function draw() {
- context.fillRect(myX,myY,30,30)
- // This is how you draw a rectangle
- }
- function keyup (key) {
- // Show the pressed keycode in the console
- console.log("Pressed", key);
- };
- function mouseup() {
- // Show coordinates of mouse on click
- console.log("Mouse clicked at", mouseX, mouseY);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement