Constructor
new Rocket(storage, x, y, xs, yx)
Parameters:
Name | Type | Description |
---|---|---|
storage |
array | Array of GameObject to store itself in |
x |
number | x coordinate |
y |
number | y coordinate |
xs |
number | x component of velocity vector |
yx |
number | y component of velocity vector |
- Source:
Extends
Members
dir :number
Direction to point in; Used both for physics and rendering
Type:
- number
- Source:
dummy
Workaround for passing coordinates into non overloaded functions.
This is used for calculating physics and should eventually
become deprecated. Fingers crossed
- Source:
iva :object
Canvas image object to be drawn
Type:
- object
- Source:
iva_path :string
Path of the rocket IVA image file. Taken from www.dreamstime.com/
Type:
- string
- Source:
landed :boolean
Landed flag
Type:
- boolean
- Source:
rails :array
Array of all coordinate points of physics predictions FORMAT: [x,y,x_speed,y_speed]
Type:
- array
- Source:
size :number
Size of the rocket hitbox, and scale factor of texture
Type:
- number
- Source:
texture :object
Canvas image object to be drawn
Type:
- object
- Source:
texture_path :string
Path of the rocket texture image file. This file has been sitting around my computer for YEARS, no idea where I got it from.
Type:
- string
- Source:
trails :array
Storage for rocket exhaust trail
Type:
- array
- Source:
trails_gradient :object
Colour gradient used for rocket trails
Type:
- object
- Source:
type :string
Descriptor of object i.e. "planet" or "rocket"
Type:
- string
- Overrides:
- Source:
x :Number
x coordinate
Type:
- Number
- Overrides:
- Source:
x_speed :number
x component of velocity vector
Type:
- number
- Source:
y :Number
y coordinate
Type:
- Number
- Overrides:
- Source:
y_speed :number
y component of velocity vector
Type:
- number
- Source:
Methods
accelerate(velocity)
Accelerates the Rocket by the passed velocity vector
Parameters:
Name | Type | Description |
---|---|---|
velocity |
array | velocity vector to be applied |
- Source:
calc_rails(iter)
Calculates and generates the Rocket#rails attribute
Parameters:
Name | Type | Description |
---|---|---|
iter |
number | Was formerly a recursive function. Now specifies mode |
- Source:
- To Do:
-
- good lord clean this function up. It. Is. A. Mess.
draw()
Draws the full rocket sprite to the canvas
- Source:
rotate(direction)
Rotates the Rocket in the passed direction
Parameters:
Name | Type | Description |
---|---|---|
direction |
number | rotational direction |
- Source:
thrust()
- Source:
tick()
Applies physics and updates positional attributes
- Source: