exports

new exports(pos, rotation, Scale, sprite, collision, follow, stopDist)

Create a new NPC.
Parameters:
NameTypeDescription
posVec2Initial position of actor
rotationnumberRotation of actor
Scalenumber | Vec2of actor
spritestring | Sprite | nullSprite for visual rendering
collisionstring | nullCollision (optional)
followActor | nullActor to follow (optional)
stopDistnumberDistance to stop following at

Extends

Methods

doMove(move, elapsed)

Perform the movement controlled by a controller.
Parameters:
NameTypeDescription
moveVec2Movement vector
elapsednumberTime since last update

doMoveIter(elapsed)

Perform multiple movements in a single frame. Helps with accuracy.
Parameters:
NameTypeDescription
elapsednumberTime since last update cycle in seconds

setController(id)

Set the controller of the moving actor.
Parameters:
NameTypeDescription
idstringID of the controller type to use