Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ship

Describes the space ship the player controls. Can head towards a given point, thrust in this direction and dispatch an event to the main program in order to create the Laser beams and a Hotspot. Handles its energy and dispatches it to

  • shield when hit,
  • thrust when moving
  • and laser guns while charging

Hierarchy

Index

Constructors

constructor

Properties

charged

charged: number = 0

Private charging

charging: boolean = false

coolDown

coolDown: number = 0

energy

energy: number = 1

expendable

expendable: boolean = false

gunLeft

gunLeft: Gun = new Gun(new Vector(10, -12))

gunRight

gunRight: Gun = new Gun(new Vector(10, 12))

Protected hitRadius

hitRadius: number = 0

position

position: Vector

Private rotation

rotation: number = 0

Private thrusting

thrusting: boolean = false

Private timeShield

timeShield: number = 0

velocity

velocity: Vector

Static Private acceleration

acceleration: number = 20

Static Private energyToCharge

energyToCharge: number = 0.002

Static Private energyToShield

energyToShield: number = 0.4

Static Private energyToThrust

energyToThrust: number = 0.003

Static Private timeCooling

timeCooling: number = 0.5

Static Private timeEnergyRestore

timeEnergyRestore: number = 20

Static Private timeToChargeFully

timeToChargeFully: number = 1

Static Private timeToShowShield

timeToShowShield: number = 2

Methods

accelerate

  • accelerate(): void
  • Returns void

charge

  • charge(_on: boolean): void
  • Parameters

    • _on: boolean

    Returns void

draw

  • draw(): void
  • Returns void

drawExhaust

  • drawExhaust(): void
  • Returns void

getLaserPath

  • getLaserPath(_gun: Gun, _target: Vector): Function
  • Parameters

    Returns Function

head

  • Parameters

    Returns void

hit

  • hit(): void
  • Returns void

isHitBy

move

  • move(_timeslice: number): void
  • Parameters

    • _timeslice: number

    Returns void

shoot

  • shoot(_target: Vector): void
  • Parameters

    Returns void

thrust

  • thrust(_on: boolean): void
  • Parameters

    • _on: boolean

    Returns void

Generated using TypeDoc