Class: SimplePathComponent

SimplePathComponent

FM.SimplePathComponent

new SimplePathComponent(pOwner)

The simple path component can make a game object follow a predefined path.
Parameters:
Name Type Description
pOwner FM.GameObject The game object that owns this component.
Author:
  • Simon Chauvin
Source:

Extends

Members

name :FM.ComponentTypes

Component's name.
Type:
Inherited From:
Source:

owner :FM.GameObject

Component's owner.
Type:
Inherited From:
Source:

Methods

add(pX, pY, index)

Add a waypoint to the path.
Parameters:
Name Type Description
pX int X position.
pY int Y position.
index int Optional index at which adding the waypoint.
Source:

clearPath()

Erase every waypoints in the path.
Source:

destroy()

Destroy the path.
Source:

getCurrentIndex() → {int}

Return the current index of the waypoint to reach.
Source:
Returns:
Index of the waypoint to reach.
Type
int

getCurrentWaypoint() → {Object}

Return the current waypoint to reach.
Source:
Returns:
Waypoint to reach, a literal with a x and y property.
Type
Object

getLength() → {int}

Return the number of waypoints.
Source:
Returns:
Number of waypoints.
Type
int

getWaypoints() → {Array}

Return the waypoints of the path.
Source:
Returns:
Waypoints of the path.
Type
Array

isActive() → {boolean}

Check if the path is being followed.
Source:
Returns:
Whether the path is being followed.
Type
boolean

isLastWaypointReached() → {boolean}

Check if the last waypoint has been reached.
Source:
Returns:
Whether the last waypoint has been reached or not.
Type
boolean

remove(pIndex)

Remove a waypoint from the path.
Parameters:
Name Type Description
pIndex int Index of the waypoint to remove.
Source:

resumeFollowingPath()

Continue following the current path where it had stopped.
Source:

startFollowingPath(pSpeed, pIndexToStartFrom)

Follow the specified path.
Parameters:
Name Type Description
pSpeed int Speed at which the game object must follow the path.
pIndexToStartFrom int The index at which the game object should start following the path.
Source:

stopFollowingPath()

Stop following the current path.
Source:

update(dt)

Update the component.
Parameters:
Name Type Description
dt float Fixed delta time in seconds since the last frame.
Source: