name |
string
|
eg "bee", "hornet" |
action |
string
|
"move", "attack", "death" |
frame |
integer
|
0 to monsters[name].frames[action].length - 1 |
base |
Array
|
base in state corresponding to monster |
x1 |
pixels
|
sprite's current center X, used by ctx.translate |
y1 |
pixels
|
sprite's current center Y, used by ctx.translate |
angle1 |
radians
|
Math.atan2(y2 - y1, x2 - x1) - Math.PI/2 (a 90 degree subtraction is to keep the sprite facing up) |
x2 |
pixels
|
sprite's destination center X, same as x1 if not moving |
y2 |
pixels
|
sprite's destination center Y |
angle2 |
radians
|
sprite's destination direction, same as angle1 if it's not rotating |
velocity |
pixels
|
0.0 if the sprite is stationary |
deltaX |
pixels
|
added to x1 each tick, Math.cos(angle1 + Math.PI/2) * velocity (the 90 degree addition is to remove the sprite facing up) |
deltaY |
pixels
|
added to y1 each tick, Math.sin(angle1 + Math.PI/2) * velocity |
deltaAngle |
degrees
|
- added to angle1 each tick, controls how fast sprites |
live |
boolean
|
if false, gets removed from sprites array |
status |
string
|
"idle", "selectable", "selected", "moving", "attacking", "defending", "killed" |