Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_spline

Plugin, ACE table, Discussion thread
Dependence: None

Introduction
Move Sprite along a spline path.

Usage
Sample capx
Build path by points
Spline path is composed of points. Call these actions to build a path.
  • Clean all points by "Action:Clean all points"
  • Add points of the path by "Action:Add point".
  • Change the position of a point by "Action:Reset position"
Looping
Set property "Looping" to "Yes", or set it by "Action:Set looping" to move around path continually.
Read points
Read all points or a point by "Expression:Point"
  • Expression:Point , read all points in JSON string
  • Expression:Point( index ) , read a point by index (0-based) in JSON string
  • Expression:Point( index , 0 ) or Expression:Point ( index , "x" ) , read X co-ordinate of a point
  • Expression:Point( index , 1 ) or Expression:Point ( index , "y" ) , read Y co-ordinate of a point
Get amount of points by "Expression:PointsCount".

Start moving
Call "Action:Start" to start moving at a point, "Condition:On reach last point" will be triggered while reaching the last point of path.
"Condition:Is moving" will return true while moving.
Current segment
"Condition:On reach any point" will be triggered while object reach any point.
Get point index of current segment by
  • Expression:CurSegP0 , start point index of current segment
  • Expression:CurSegP1 , end point index of current segment
Get X/Y co-ordinate of start or end point by
  • Expression:CurSegP0( 0 ) or Expression:CurSegP0( "x" ) , X co-ordinate of start point
  • Expression:CurSegP0( 1 ) or Expression:CurSegP0( "y" ) , Y co-ordinate of start point
  • Expression:CurSegP1( 0 ) or Expression:CurSegP1( "x" ) , X co-ordinate of end point
  • Expression:CurSegP1( 1 ) or Expression:CurSegP1( "y" ) , Y co-ordinate of end point
Pause/resume
Pause or resume moving by "Action:Set enabled" with parameter "disable" or "enable".
Stop
Call "Action:Stop" to stop moving.
Speed
Object will move alone path with a constant set in property "Speed", or change it at runtime by "Action:Set speed". Read it back by "Expression:Speed".
Angle
Set property "Set angle" to "Yes" to set object's angle to the angle of motion. Or get this angle of motion by "Expression:AngleOfMotion".
Tension
Property "Tension" will change the curve of moving path.

Official save/load
This behavior supports official save/load feature.

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About