↖️ Back to specs

«interface»
Updatable
+update()
«interface»
Drawable
+draw()
«abstract»
GameElement
#pose : Pose
#velocity : Vector2D
#radius : double
#destroyed : boolean
+GameElement(pose : Pose, velocity : Vector2D, radius : double)
+getPose() : Pose
+getVelocity() : Vector2D
+getRadius() : double
+isDestroyed() : boolean
+setDestroyed(destroyed : boolean)
+checkCollision(other : GameElement) : boolean
+update()
Ship
+SHIP_WIDTH : int {readOnly=10}
+SHIP_HEIGHT : int {readOnly=20}
+SHIP_TURN : double {readOnly=0.1}
+SHIP_MOVE : double {readOnly=0.1}
+FRICTION : double {readOnly=0.02}
+Ship()
+turnLeft()
+turnRight()
+thrust()
+update()
+draw()
Bullet
+BULLET_RADIUS : double {readOnly=1.5}
+BULLET_SPEED : int {readOnly=20}
+BULLET_DURATION : int {readOnly=20}
-counter : int
+Bullet(pose : Pose)
+update()
+draw()
«abstract»
Enemy
#points : int
+Enemy(speed : double, radius : double, points : int)
+getPoints() : int
«enumeration»
AsteroidSize
SMALL
MEDIUM
LARGE
-radius : int
-points : int
-AsteroidSize(radius : int, points : int)
+getRadius() : int
+getPoints() : int
+randomSize() : AsteroidSize
Asteroid
+ASTEROID_SPEED : int {readOnly=1}
+Asteroid(size : AsteroidSize)
+draw()
Saucer
+HALF_WIDTH : int {readOnly=10}
+HALF_HEIGHT : int {readOnly=5}
+SAUCER_SPEED : int {readOnly=2}
+SAUCER_POINTS : int {readOnly=400}
+SPAWN_PROB : double {readOnly=0.002}
+TURN_PROB : double {readOnly=0.05}
+Saucer()
+update()
+draw()
Star
-location : Point
+STAR_RADIUS : int {readOnly=1}
+Star(x : double, y : double)
+getLocation() : Point
+draw()
NumericDisplay
-prefix : String
-value : int
-location : Point
+NumericDisplay(xPos : int, yPos : int, prefix : String, value : int)
+getLocation() : Point
+getValue() : int
+setValue(value : int)
+draw()
«interface»
Playable
+update()
+draw()
+startGame()
AsteroidsGame
+LIVES : int {readOnly=3}
-drawElements : ArrayList<Drawable>
-updateElements : ArrayList<Updatable>
-shipAndBullets : ArrayList<GameElement>
-enemies : ArrayList<Enemy>
-ship : Ship
-score : NumericDisplay
-lives : NumericDisplay
+AsteroidsGame()
+addEnemy(enemy : Enemy)
-newStars()
-newEnemies()
-newShip()
-handleKeyboardInput()
+update()
+draw()
+handleCollisions()
+removeDestroyedBullets()
+removeDestroyedEnemies()
+startGame()
#randomXPosition() : double
#randomYPosition() : double
#randomHeading() : double