muhammadtarek/starship

Bullet class

muhammadtarek opened this issue · 0 comments

Control all bullets state, removal and damage control

class BulletsObserverr {
  bullets: Bullet[]
}
interface Bullet {
  id: string,
  imgELement: HTMLImageELement,
  /**
   * Image URL
   */
  img: string,
  /**
   * Damage number
   */
  damage: number,
  /**
   * Who created the bullet
   */
  creator: Creator
  /**
   * Current bullet position
   */
  position: Position,
  /**
   * Move bullet by setInterval each 1 second
   */
  move: () => void
}

Interfaces should be implemented as Objects

interface Creator {
  player: number,
  enemy: number
}
interface Position {
  x: number,
  y: number
}