Manual: Picking Up and Throwing Objects

About this manual

This manual explains the pick-up / throw feature built into ACTION GAME MAKER.

How picking up and throwing work in ACTION GAME MAKER

Picking up and throwing are performed by the actions “CarryObject” and “ReleaseCarriedObject”. Both are in the Object Control category under “Add Other Action”.

These two actions grab the objects already placed on the map. Where “BindObjects” creates a new instance from a scene and attaches it, these grab an existing instance, so what you pick up is carried with its own variables, switches, health, appearance and animation intact. That lets you build lifting and throwing a pot or a rock, picking up and lobbing a bomb, or carrying a stunned enemy on your shoulder.

While something is held, you can disable its wall collision, hit collision, attack collision and movement. Whatever you disabled here, and any variable or switch this action changed, is restored automatically when it is put down (or thrown).

The connector

What you pick up is attached to your connector. In object editing, add a connector to the object doing the carrying and place it where things should be held — above the head, in the hand, and so on.

With no connector specified, things are held at the object’s centre. Separating connectors lets one object hold several things at once (a pot above the head, a bomb in the hand).

Building the object that gets carried

The pick-up action has a field called “value to set on the target”. The recommended pattern is to rewrite the carried object’s switch/variable there, and have the carried object move to its own action with a “SwitchVariableChanged” condition.

On the carrier, set the target’s switch “being carried” to ON (restored on release).
On the carried object, transition to a “being carried” action when “being carried” turns ON (no movement).
On the thrower, set the target’s switch “thrown” to ON.
On the carried object, transition to a “flying” action when “thrown” turns ON (attack collision on; vanish plus a debris effect on hitting a wall).

Set up this way, the carrier never needs to know anything about the target’s action structure. The only agreement is the switch name, so a pot, a rock, a bomb or an enemy can all be handled by the same single pick-up node.

“CarryObject” settings

Carry Target Type

Choose how the object to pick up is decided, from these four.

Type What it does
Nearest Object Narrows by target group, distance and facing, and picks up the closest of those
The last contacted object Picks up the object obtained by a contact condition
A specified locked object Picks up the object this object has locked
An object on the shared board Picks up the object recorded in an object reference key on the shared board (Blackboard)

Only “Nearest Object” shows the following three.

  • Target group: choosing anything but “all objects” limits the candidates to that object group. Grouping everything liftable into a “liftable” group is the easy approach.
  • Max distance (0 for unlimited): limits candidates to within that distance (px). The default is 48px.
  • Require Facing: limits candidates to things on the side you are facing.

Objects already held by someone else are not candidates.

The condition for choosing a target

You can look at the target’s variables and switches to decide whether it can be picked up — “only things weighing 100 or less”, “only while it is upside down”.

  • Carry Condition Type: choose from “no condition”, “switch” or “variable”.
  • Carry Condition Name: the switch or variable name to read on the target. Name candidates are enumerated from the “representative scene for the target”, but at runtime the target is resolved by name, so any object with a switch or variable of the same name works even if it is a different kind from the representative scene.
  • Comparison (for a variable): choose from “=”, “!=”, “<”, “<=”, “>” or “>=”.
  • Where the condition’s value comes from: choose from “a constant”, “my own variable” or “a project variable”.

Objects that do not satisfy the condition drop out of the candidates. Because the check happens while narrowing candidates, even with “Nearest Object”, an unliftable thing in front never hides a liftable thing behind it.

Attachment

  • Carry Connector Path: the connector that becomes the holding position. Leave it empty to hold at the centre.
  • Carry Adjust Position: specify this to offset further from the connector.
  • Carry Takeover Disp Direction / Angle / Scaling: match the held object to your facing, angle and size (all default to ON).
  • Carry Lower Priority: draws the held object behind you. It has no effect when you and the held object are on different layers.
  • Carry Overwrite Existing: what to do when you are already holding something on the same connector. ON (the default) puts down what you are holding and swaps; OFF does nothing.

While it is held

So that collisions do not go wild the moment something is picked up, the target’s checks and movement are disabled by default.

  • Carry Disable Wall Collision (default ON): stops the held object shoving the carrier aside, bouncing it sideways or slowing it down.
  • Carry Disable Hit Area (default ON): the held object stops taking damage.
  • Carry Disable Attack Area (default OFF): stops the held object’s attack collision. Turn it ON when you do not want it hitting enemies while held.
  • Carry Suppress Movement (default ON): stops the held object’s movement processing. It also stops accepting velocity from gravity and force areas, so velocity cannot build up while held and go off the moment it is put down.

Whatever you disabled here returns to the state it was in before the pick-up when the object is put down or thrown (a check that was already off does not come back on by itself). Note that the held object’s visual script does not stop, so its action transitions and presentation can keep running while it is held.

Setting a value on the target / on yourself

On picking something up, you can change one switch or variable on the target (the held object) and one on yourself (the carrier).

  • Set on the target / Set on yourself: choose from “no change”, “switch” or “variable”.
  • Name: the switch or variable name to change.
  • Operator (for a variable): “=”, “+=”, “-=”, “*=”, “/=”, “%=”
  • Where the value comes from: choose from “a constant”, “my own variable” or “a project variable”.
  • Restore the target’s value on release / Restore my value on release (default ON): restores the original value whether it was put down, thrown, the held object vanished or the carrier vanished. That reliably returns the carrier’s “holding” switch to OFF, so you never freeze in the carrying pose when what you were holding is destroyed.

“ReleaseCarriedObject” settings

The target

  • Release All: turn it ON to put down everything you are holding, regardless of connector.
  • Source Connector Path: which connector’s held object to put down. Leave it empty and the target is whatever is held at the centre.

Leaving the connector empty targets only “the object held at the centre”. It does not mean “all”, so use “Release All” when you want to put down things held on several connectors at once.

The condition for choosing a target

In the same form as on the pick-up side, you can read the target’s variables and switches to decide whether it can be put down. A held object that does not satisfy the condition drops out and stays held. Use it for “too heavy to throw”.

Throw Direction Type

Type What it does
My display direction Throws in the direction the carrier is facing
Specify an angle Throws at the angle given in “direction (angle)” (0 degrees is right; positive is clockwise)
The aim direction Throws in the stick’s or mouse’s aim direction. With no input, it throws in the display direction
Specify the angle with a variable Reads the angle from a variable or the database and throws
My own angle Throws in my (the root’s) rotation direction. It suits things like a rotating turret, where you want the angle at the moment of throwing
  • Base angle (with “My own angle”): specify how far the artwork’s front is from right (0 degrees). For artwork drawn facing up, enter -90. It means the same as the base angle in “ChangeAngleSettings”.
  • Aim source / use the mouse when the stick is not pushed (with “The aim direction”): choose from the left stick, the right stick or the mouse.

Throwing velocity

  • Throw Speed: the initial speed given in the chosen direction. 0 puts the object down on the spot.
  • Throw Up Speed: the initial speed given upward. Combined with the forward speed, it flies in an arc.
  • Inherit Carrier Velocity: adds the carrier’s current velocity to the throw. Throwing while running sends things further.
  • Ignore Thrower Duration (default 0.2 seconds): how long the thrown object is kept from hitting you right after the throw. The attack collision exemption from the parent-child relationship ends the moment it is released, so this time is necessary if the thrown object carries an attack collision. 0 means no exemption.

The upward speed is added after the direction is applied. To send something straight along the angle you specified, set the upward speed to 0.

Setting a value on the target / on yourself

On throwing or putting down, you can change one switch or variable on the target and one on yourself. Restoring the changes made at pick-up time is handled automatically inside the action, so here you only set the extra changes specific to throwing (setting a “thrown” switch to ON, for example). Values written by this action are not restored.

When it is released automatically

In the following cases the carry is released without placing an action, and the disabled checks and changed values are restored.

  • When “ReleaseCarriedObject” runs
  • When the held object vanishes (the carrier’s values are restored)
  • When the carrier vanishes (the held object’s checks and values are restored)
  • When something else is swapped in on the same connector
  • When “ChangeObject” turns the carrier or the held object into a different object (the carry state is carried over)

For 0.2 seconds after being put down, the carrier and the held object do not push each other. The held object is left overlapping the carrier, and without that grace period it would be shoved away and go flying the moment it was released.

Worked examples

Lifting and throwing a pot

On the player side, build it with two visual script nodes.

Confirm button + something in the “liftable” group within 48px in front → “CarryObject”

  • Carry Target Type = Nearest Object (group “liftable” / distance 48 / facing only)
  • Carry Connector Path = the connector above the head
  • While held = wall collision off / hit collision off / attack collision off
  • Set on the target = switch “being carried” to ON (restored on release)
  • Set on yourself = switch “holding” to ON (restored on release)

Attack button → “ReleaseCarriedObject”

  • Source Connector Path = the connector above the head
  • Throw Speed = 300 / Throw Up Speed = 100
  • Set on the target = switch “thrown” to ON

On the pot side, build it like this.

  • Switch “being carried” is ON → the “being carried” action (no movement)
  • Switch “thrown” is ON → the “flying” action (falling, attack collision on)
  • Contact with a wall, the floor or an enemy → vanish plus a debris effect

Things too heavy to throw

Set the “condition for choosing a target” on “ReleaseCarriedObject” to variable “weight” 100 or less. Heavy things can be picked up but not thrown, and stay held. Provide a separate put-down action (speed 0, no condition) and you get a “heavy things can only be carried and set down” mechanic.

A bomb you pick up and throw

On the bomb side, move to a fuse action when the switch “being carried” turns ON, and explode after a set time. Disabling the attack collision in the pick-up action means you do not get hurt by the blast while holding it. Setting a generous “Ignore Thrower Duration” on the throwing side prevents blowing yourself up right after the throw.

Things to watch out for

  • Saving is not supported. Save while holding something and load, and the held object returns to its original position.
  • It is not carried across scene transitions. Move to another map and you leave the held object behind.
  • If the thrown object deals damage, always set “Ignore Thrower Duration”. At 0 it can hit you the instant you throw it.
  • “Carry Lower Priority” only has an effect when the carrier and the held object are on the same layer.
  • Turning “Carry Suppress Movement” OFF means the held object keeps receiving gravity and force area forces while held. If the behaviour on release is erratic, turn it back ON.