About this manual
This manual explains the two features in ACTION GAME MAKER that give an object velocity: the action “SetObjectVelocity” and the map element “ForceArea2D”.
How velocity works in ACTION GAME MAKER
Movement is normally produced by movement templates or by the player’s input. These two features are different: they give the object a “velocity applied from outside”, separate from its movement. Use them for launching off a jump pad, being carried by a conveyor belt, being swept along by a current, or being knocked back by a hit.
Both use pixels per second (px/s). Positive X is right and positive Y is down. To send something upward, enter a negative Y.
An applied velocity is not just for the instant it is applied — the object keeps hold of it. See “When an applied velocity goes away” below for when it disappears.
“SetObjectVelocity”
The action that applies velocity from a visual script. It is in the “Object Control” category under “Add Other Action”. Combined with conditions, it lets you dash the moment a button is pressed, knock something back when it is hit, and so on.
Choosing the target
- Object To Move Type: choose from “group”, “a specified object”, “the last contacted object” or “a locked object”.
- Group: with the type set to “group”, pick the target object group. Choosing “all objects” targets everyone.
- Target Type: with the type set to “a specified object”, choose from “myself”, “every object but myself” or “a specified object”.
- Target object path / Target Scope: with the target type set to “a specified object”, specify the object file and whether it is one or all of them.
Specifying the velocity
- X Operation / Y Operation: choose from “No Change”, “Set” or “Add”. “Set” ignores the current velocity and uses the value you give; “Add” adds your value to the current velocity. Setting both to “No Change” does nothing.
- Velocity: the velocity to apply (px/s). X and Y are given separately.
- Coord Space: choose “World” (the default) or “Local”. World uses the screen’s axes (positive X right, positive Y down); Local rotates the axes with the rotation of the object that ran the action. Scale is ignored.
This action runs once each time you enter the state. If you need something that keeps pushing every frame, use “Set” or “Accelerate” on a force area, described below.
“ForceArea2D”
A map element that manipulates the velocity of objects entering a region placed on the map. It lets you build conveyor belts, currents, jump pads and updrafts without wiring up a visual script.
Placing one
- Open a map in the map editing view.
- Choose “Force Area” from the add menu on the “Map Layers” dock.
- Fit the shape and size of the ForceCollision created with it (a 128 x 128 rectangle) to the region you want the effect in.
- Configure the velocity operations in the Inspector.
Which objects are affected
What is affected is the wall collision of a game object itself, as detected by the area’s collision mask. Touching it with a hit collision or an attack collision does not trigger it. A lightweight object is targeted when the object itself enters the region.
- Group: targets “all groups” or only a specified object group.
- The object that owns the area is never a target (even when you put a force area inside an object, that object does not move).
The velocity operations
- Coord Space: choose “Local” (the default) or “World”. With Local, rotating the area rotates the direction of the force with it, so you can build a diagonal conveyor or a wind that blows at an angle. World works on the screen’s axes regardless of the area’s rotation. Scale is ignored.
- X Operation / Y Operation: choose from “No Change”, “Set”, “Add on Enter” or “Accelerate” (see the table).
- Velocity: the velocity used by “Set” and “Add on Enter” (px/s).
- Acceleration: the acceleration used by “Accelerate” (px/s²).
- Maximum Velocity: the cap for “Accelerate” (px/s). 0 accelerates without a cap.
| Operation | What it does | What it suits |
|---|---|---|
| No Change | Does not touch that axis’s velocity | When you only want to affect one axis |
| Set | Overwrites with that velocity every frame while inside the region | Conveyor belts, a current at a constant speed |
| Add on Enter | Adds once, the moment the object enters. Leaving and re-entering adds again | Jump pads, launchers |
| Accelerate | Adds the acceleration on every physics frame | Updrafts, gravity zones |
Which fields are shown changes with the operation you pick.
Exit settings
- X Exit Operation / Y Exit Operation: choose “Keep Velocity” (the default) or “Stop”. “Keep Velocity” keeps the velocity gained from the area after leaving the region. “Stop” zeroes that axis the moment the object leaves.
For anything that should keep flying after it leaves — a jump pad or a launcher — choose “Keep Velocity”; for anything that should only move inside the region, choose “Stop”.
When an applied velocity goes away
A velocity applied from outside is kept by the object. It goes away at these points.
- Vertical velocity: goes away on landing. It stays while airborne, and gravity adds to it.
- Horizontal velocity: goes away while the object is on the ground and no new velocity is being applied.
- After leaving a force area, it stays if the exit setting is “Keep Velocity”, and only that axis is zeroed if it is “Stop”.
So an object launched from a jump pad keeps flying until it lands, and something sliding as if on ice comes to a stop naturally after it touches the ground. Note that if an upward velocity is applied while the object is on the ground, the vertical velocity is protected from being cleared for the few frames it takes to leave the floor.
Which to use
| What you want | The feature and settings |
|---|---|
| Conveyor belt | Force area: X Operation = Set |
| Current | Force area: the axis you want to sweep along = Set (rotate the area in Local space for a diagonal current) |
| Jump pad / launcher | Force area: Y Operation = Add on Enter (with a negative Y) |
| Updraft / gravity zone | Force area: Y Operation = Accelerate + a maximum velocity |
| Movement only inside the region | Force area: exit velocity = Stop |
| Dash on a button | SetObjectVelocity: X Operation = Set |
| Knockback on a hit | SetObjectVelocity: both axes = Set (or the “KnockbackSelf” action) |
| Moving another object | SetObjectVelocity: use the object-to-move type to specify a group or a locked target |
Worked examples
A conveyor belt
- Place a force area on top of the floor and fit the collision to the floor’s length.
- Set Coord Space = World, X Operation = Set, Velocity X = 100.
- Setting X Exit Operation = Stop stops the flow the moment you step off the belt. “Keep Velocity” lets you slide a little after stepping off.
A jump pad
- Place a thin force area on top of the pad.
- Set Y Operation = Add on Enter and Velocity Y = -600.
- Set Y Exit Operation = Keep Velocity (with Stop, you drop the instant you leave the region).
Wind that blows upward
- Place a force area over the region the wind occupies.
- Set Y Operation = Accelerate, Acceleration Y = -400, Maximum Velocity Y = 200.
- Once the acceleration beats gravity, things are carried upward and level off at the maximum velocity. Leaving the region, they start falling under gravity.
Dash on a button
- Build a dash button input condition in the player’s visual script.
- Place “SetObjectVelocity” with Object To Move Type = a specified object and Target Type = myself.
- Set Coord Space = World, X Operation = Set, and put the dash speed in Velocity X. If you want the sign to depend on facing, either split it into a right-facing and a left-facing action or branch on a condition that reads the display direction.
Things to watch out for
- Setting Coord Space to “Local” in “SetObjectVelocity” inverts the vertical sign on a horizontally flipped object (while facing left, a negative Y points downward). To specify a vertical direction reliably, use “World”.
- Setting Coord Space to “Local” in “SetObjectVelocity” also writes back the current velocity on an axis set to “No Change”. If you only want to touch one axis, “World” behaves more straightforwardly.
- Velocity is applied every frame while inside a force area, so horizontal velocity does not go away even on the ground. If you want things to stop inside the region, set the velocity to 0 or stop it with the exit setting.
- An object being carried does not receive outside velocity while “Carry Suppress Movement” is enabled on the carry action (so that it does not go flying from accumulated velocity the moment it is put down).
- Force areas do not trigger on hit collisions or attack collisions. If nothing happens, check that the area’s collision mask and the target object’s wall collision layer line up.
- Leaving Maximum Velocity at 0 with “Accelerate” keeps accelerating for as long as the object is in the region. That can cause objects to pass through walls, so a cap is recommended.