SHARE
TWEET

Untitled

a guest Nov 22nd, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Spaceship {
  2.     constructor(x, y, image) {
  3.         this.x = x;
  4.         this.y = y;
  5.         this.image = image;
  6.     }
  7.     draw() {
  8.         image(this.image, this.x, this.y, 150, 100);
  9.         this.ctrls();
  10.     }
  11.     shoot() {
  12.        
  13.     }
  14.     ctrls() {
  15.         if (keyIsPressed && (key == "w"))
  16.           this.y -= 5
  17.         if (keyIsPressed && (key == "s"))
  18.           this.y += 5
  19.         if (keyIsPressed && (key == "a"))
  20.           this.x -= 5
  21.         if (keyIsPressed && (key == "d"))
  22.           this.x += 5
  23.   }
  24. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top