diff options
Restructured Folder
1 files changed, 31 insertions, 0 deletions
| -rw-r--r-- | scripts/gameObjects/tankShell.js | 31 |
diff --git a/scripts/gameObjects/tankShell.js b/scripts/gameObjects/tankShell.js new file mode 100644 index 0000000..5f87143 --- /dev/null +++ b/scripts/gameObjects/tankShell.js @@ -0,0 +1,31 @@ +var app = app || {}; + +class TankShell { + constructor(sprite, position, direction) { + this.sprite = sprite; + this.sprite.x = position.x; + this.sprite.y = position.y; + this.direction = direction; + } + + update() { + switch(this.direction) { + case "up": + this.sprite.y--; + break; + case "right": + this.sprite.x++; + break; + case "down": + this.sprite.y++; + break; + case "left": + this.sprite.x--; + break; + } + } + + draw() { + app.pixiApplication.stage.addChild(this.sprite); + } +} |