Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Spaceship {
- constructor(x, y, image) {
- this.x = x;
- this.y = y;
- this.image = image;
- }
- draw() {
- image(this.image, this.x, this.y, 150, 100);
- this.ctrls();
- }
- shoot() {
- }
- ctrls() {
- if (keyIsPressed && (key == "w"))
- this.y -= 5
- if (keyIsPressed && (key == "s"))
- this.y += 5
- if (keyIsPressed && (key == "a"))
- this.x -= 5
- if (keyIsPressed && (key == "d"))
- this.x += 5
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement