Skip to content

Commit

Permalink
Outline Tank Class
Browse files Browse the repository at this point in the history
  • Loading branch information
ab2163 committed Feb 17, 2025
1 parent 838f659 commit 0777a4b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Class-Definitions
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ GridArray attribute with references to wall and floor instances
Tank Class:
Draw Method()
Fire Method() [spawns an instance of the relevant weapon]
Destroy Method() [animating the Tank desttruction]
Destroy Method() [animating the Tank destruction]
Update() Method

Wall Class:
Expand Down
34 changes: 34 additions & 0 deletions docs/Tank.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class Tank{

tankWeapon; //which particular type of weapon the tank has
bullets; //how many bullets the tank has left available
tankLife; //remaining life of the tank

//note the image, rotation and speed will be attributes of the sprite

//locX and locY are the initial co-ordinates
//initialDirection is the initial direction the tank is pointing in
//initialWeapon is the weapon the tank has to begin with
constructor(locX, locY, initialDirection, initialWeapon){
//create a sprite in P5 Play for the tank
}

draw(){
//call the draw method of the underlying sprite
}

fire(){
}

destroy(){
}

update(){
//call the update method of the underlying sprite
}

//updates the rotation and speed attributes of the tank sprite
//directionOfMove corresponds to either UP, DOWN, LEFT or RIGHT
move(directionOfMove){
}
}

0 comments on commit 0777a4b

Please sign in to comment.