[go: nahoru, domu]

Skip to content

A Trajectory behavior for Construct 3, Simulate 2D physics trajectory and projectile motion. simulates the motion of an object that is thrown, launched, or otherwise projected

Notifications You must be signed in to change notification settings

armandoalonso/trajectory

Repository files navigation


Trajectory

A Trajectory behavior for Construct 3, Simulate 2D physics trajectory and projectile motion. simulates the motion of an object that is thrown, launched, or otherwise projected

Author: piranha305
Addon Url: https://www.construct.net/en/make-games/addons/1088/trajectory
Made using c3ide2-framework

Table of Contents


Usage

To build the addon, run the following commands:

npm i
node ./build.js

To run the dev server, run

npm i
node ./dev.js

The build uses the pluginConfig file to generate everything else. The main files you may want to look at would be instance.js and scriptInterface.js

Examples Files







Properties

Property Name Description Type
Enabled If Enabled, the object will move along the trajectory paths check
Velocity Speed which the object will move in pixels per second integer
Angle Angle, in degrees, to launch the projectile at integer
Gravity Force applied every tick, in pixels per second squared integer
Gravity Angle Angle in which the gravity force will be applied, in degrees integer
Stop On Solid Stops the projectile movement when colliding with a Solid check
Set Movement Angle Set movement angle to match the direction of the trajectory check

Actions

Action Description Params
Set Enabled Sets the behavior as enabled (if true, the object will move along the trajectory paths) Enabled (boolean)
Set Gravity Angle Set the angle in which gravity force will be applied, in degrees Gravity Angle (number)
Set Trajectory By Velocity Calculate the trajectory based on the velocity and launch angle Velocity (number)
Launch Angle (number)
Start Instantly (boolean)
Stop On Solid (boolean)
Set Movement Angle (boolean)
Set Trajectory By Target Calculate the trajectory based on the target position and time Target X (number)
Target Y (number)
Time (number)
Start Instantly (boolean)
Stop On Solid (boolean)
Set Movement Angle (boolean)
Stop On Target Reached (boolean)
Set Trajectory By Target Angle Calculate the trajectory based on the target position and launch angle Target X (number)
Target Y (number)
Launch Angle (number)
Start Instantly (boolean)
Stop On Solid (boolean)
Set Movement Angle (boolean)
Stop On Target Reached (boolean)
Draw Trajectory Draw the trajectory using a Sprite Sprite (object)
Layer (layer)
Steps (number)
Time (number)
Set Sprite Angle (boolean)
Draw Trajectory With End Sprite Draw the trajectory using a Sprite and an end cap Sprite Sprite (object)
End Cap Sprite (object)
Layer (layer)
Steps (number)
Time (number)
Set Sprite Angle (boolean)
Clear Drawn Trajectory Clear the drawn trajectory
Predict Trajectory Collision Predict where a collision with a solid object will occur along the trajectory Steps (number)
Time (number)
Start Trajectory Start moving along predefined the trajectory
Stop Trajectory Stop moving along the trajectory
Load From JSON Load the trajectory data from a JSON string JSON (string)

Conditions

Condition Description Params
Is Enabled Check if the trajectory behavior is enabled
On Hit Solid Triggered when the projectile hits a solid object
On Start Moving Along Trajectory Triggered when the object starts moving along the trajectory
Is Moving Along Trajectory ICheck if the object is moving along the trajectory
For Each Step In Trajectory Loop through each step in the trajectory Steps (number)
Time (number)
On Predicted Collision Found Triggered when the 'Predict Trajectory Collision' action finds a collision with a solid object
No Predicted Collision Found Triggerd when the 'Predict Trajectory Collision' action does not find a collision with a solid object
On Target Reached Triggered when the object reaches the target position

Expressions

Expression Description Return Type Params
GetXAt Get the X position at a given time, in seconds number Time (number)
GetYAt Get the Y position at a given time, in seconds number Time (number)
GetVelocityX Get the current velocity X, in pixels per second number
GetVelocityY Get the current velocity Y, in pixels per second number
GetAngleAt Get the angle at a given time, in seconds number Time (number)
GetMaxHeight Get the maximum height of the trajectory, in pixels number
GetLoopTimeStep Get the time step, in seconds, between each loop iteration number
GetLoopX Get the current X position, between each loop iteration number
GetLoopY Get the current Y position, between each loop iteration number
GetLoopAngle Get the current angle, in degrees, between each loop iteration number
GetCollisionX Get X position from Predicted Trajectory Collision number
GetCollisionY Get Y position from Predicted Trajectory Collision number
Time Get the last trajectory's time, in seconds, if no time was set, returns -1 number
TargetX Get the last trajectory's target X, if no target was set, returns -1 number
TargetY Get the last trajectory's target Y, if no target was set, returns -1 number
Velocity Get the last trajectory's velocity, in pixels per second number
LaunchAngle Get the last trajectory's launch angle, in degrees number
AsJSON Get the trajectory data as a JSON string string

About

A Trajectory behavior for Construct 3, Simulate 2D physics trajectory and projectile motion. simulates the motion of an object that is thrown, launched, or otherwise projected

Resources

Stars

Watchers

Forks

Packages

No packages published