Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement