About this manual
This manual explains the visual script action “Change Object Angle” (ChangeObjectAngle). It rewrites the tilt (rotation) of the target objects. Use it for effects such as “point the turret the way you are aiming”, “rotate slowly while falling” or “tilt when struck”.
What actually rotates
The object’s root rotates, and everything with it. That means the art, the wall collision, the hit collision, the attack collision and the connectors all tilt to the same angle together. It is not a look-only tilt, so the direction bullets leave a tilted turret and the way a tilted floor connects change along with it.
This is not the same as rewriting rotation directly from the Inspector. ACTION GAME MAKER implements horizontal flipping as a mirror on the transform, so putting in a rotation on its own turns a horizontally flipped object upside down. This action strips the mirror off and puts the angle back in, so the facing is kept even on a flipped object.
For that reason, use this action rather than rewriting rotation with “Change Object Property”.
How the angle is decided
| Value | Direction |
|---|---|
| 0 | The unrotated state (exactly as the art is drawn) |
| Positive | Clockwise on screen |
| Negative | Anticlockwise on screen |
The range you can specify is -360 to 360 degrees.
“0 degrees” is the art as drawn. Art drawn facing up keeps facing up; art drawn facing right keeps facing right. Whichever way the art faces, remember it as “0 = as drawn”.
The settings
Angle Apply Mode
| Option | What it is |
|---|---|
| Absolute Angle | Sets the specified angle regardless of the current one (default) |
| Relative Angle | Adds the specified angle to the angle at the moment the action ran |
The relative mode’s baseline is “the angle at the moment it ran”. That lets you stack up 90 degrees each time the state is entered.
Angle Value Source
| Option | What it is |
|---|---|
| Constant | Uses the angle typed into the field (default) |
| Variable | Reads the angle from a variable, a database, the shared board and so on |
When read from a variable, the value is treated as degrees.
The source is specified with the shared variable-slot UI, so it can be this object, a specified object, a project variable, a database, the shared board and so on.
If the variable cannot be resolved, the action does nothing. Substituting 0 would make the target face sideways unintentionally in absolute mode.
Easing Settings
| Item | What it is |
|---|---|
| Change over time | Turn it on and the rotation takes time instead of happening at once |
| Duration | Seconds (default 0.5). At 0 it is applied at once |
| Curve | How the change progresses. A linear curve is used when it is not set |
- The starting angle is captured per target at the moment the action runs.
- Leaving the state partway through stops it at that angle. It is not restored.
- With it off, the angle goes in the instant the action runs.
Target type
| Option | What it is |
|---|---|
| Group | Everyone in the specified object group (0 = all objects) |
| Set Object | Myself / the other object / an object specified by file (default) |
| The object last captured by a contact condition | Whoever the previous contact check picked up |
| Lock target | Whoever was recorded by “Lock Object” |
When you specify a file under “Set Object”, you can choose a single instance or all instances of that object.
Worked examples
Pointing a turret in an arbitrary direction
- In the turret’s visual script, put the angle you are aiming at into a variable (with “Assign Stick Input to Variable”, “Assign Mouse Information to Variable” and so on).
- Put down “Change Object Angle”:
- Angle Apply Mode: Absolute
- Angle Value Source: Variable → the variable from step 1
- Target: Set Object → Myself
- To make it follow every frame, put it in a looping state.
Bullets come out along the tilted root’s direction. Decide the muzzle position with a connector and it rotates along with everything else.
Rotating slowly while falling
- Put “Change Object Angle” in the falling state:
- Angle Apply Mode: Relative
- Angle: 360
- Change over time: on
- Duration: 2.0
- That is one rotation in two seconds. Loop the state to repeat it.
Tilting when struck
- Put “Change Object Angle” in the damage state:
- Angle Apply Mode: Relative
- Angle: 15
- Change over time: on / 0.1 seconds
- In the recovery state, run “Absolute / 0 degrees / 0.3 seconds” to straighten back up.
Tilt with relative mode and leave it there, and the tilt stacks up with every hit. Always include the processing that puts it back.
Rotating whoever you touched
- Enter a state with a “came into contact with …” condition.
- Set “Change Object Angle”'s target to “the object last captured by a contact condition”.
- Specify the angle and the time.
Resetting the tilt
- Run “Absolute / 0 degrees”. Turn the change-over-time setting off and it snaps back instantly.
Things to watch out for
- It rotates the root and everything with it. Not just the art but the wall, hit and attack collisions tilt too. If you do not want the way it connects to change, tilt on the art node’s side instead of using this action (with “rotation” in Collision Animation, for example).
- Do not rewrite
rotationwith “Change Object Property”. A horizontally flipped object ends up upside down. Always use this action to change the angle. - 0 degrees is “as drawn”. Art drawn facing up keeps facing up.
- Positive values are clockwise on screen.
- The angle is not restored. It stays tilted even after leaving the state, so put 0 degrees in explicitly wherever you want it back (this includes releasing an object you were carrying).
- Relative mode stacks up. In builds that tilt on every hit, provide a way to reset.
- If the variable cannot be resolved, nothing happens. The angle simply does not go in and no error appears, so check the variable name and scope.
- Leaving the state partway through the change stops it at that angle.
- Setting the duration to 0 applies the angle at once, even with the change-over-time setting on.
- To point automatically along the direction of travel, use the “change angle” settings rather than this action. Those settings keep the facing aligned with movement, the stick or the mouse continuously, and only one of them takes effect per object.