[Script Library] Baz Vehicle Movement Settings

BazVehicleMovementSettings

360° top-down movement for any GameObject. Tank mode (turns in place) or Vehicle mode (only turns while moving). Optional smooth acceleration.

DOWNLOAD:
baz_vehicle_movement_settings.gd (10.0 KB)

What it does

Rotates your GameObject freely in any direction and moves it the way it’s facing.

  • Tank: rotates in place even when stopped
  • Vehicle: only rotates while moving forward or backward

Turn on Accelerated for smooth ramp-up and slow-down.

Setup

  1. Save baz_vehicle_movement_settings.gd anywhere in your project. Open the GameObject scene you want to control, add a child Node2D, attach the script.

  1. On the parent GameObject, set:
Setting Value
Is Release Move Control On
Animation Sets > Auto Y Flip Animation Off (for every animation)

Y Flip off is important. It mirrors the sprite when reversing, which breaks 360° rotation.

  1. Draw your sprite pointing right (Godot’s forward direction). If it points up, rotate the GameObject node -90° in the 2D viewport. Whatever rotation you set is the starting facing direction in-game.

  2. Configure the inspector:

Field What it does
Move Forward / Backward / Turn Left / Turn Right Input Input action dropdowns. Defaults to arrow_up/down/left/right. Pick “Unset” to disable.
Movement Type Tank or Vehicle
Forward / Backward Speed Top speed in pixels per second
Left / Right Rotation Speed Turn rate in degrees per second
Accelerated OFF = instant top speed. ON reveals accel/decel fields
Debug Enabled Prints movement info to console

Hover any field for a tooltip.

  1. In the GameObject’s visual script, pick your movement state (usually Move) and add an InvokeScript Action:

    • Target Node: BazVehicleMovementSettings
    • Target Method: apply_vehicle_movement
    • Invoke Timing: OnStateUpdate
  2. (Optional) For a stop/damage/death state, add another InvokeScript Action:

    • Target Method: stop_vehicle_movement
    • Invoke Timing: OnStateEnter

Conditions

Five is_* conditions for ScriptConditionEvaluator (useful for idle vs moving animation transitions):

Method True when
is_moving speed is non-zero
is_moving_forward speed is positive
is_moving_backward speed is negative
is_tank_mode Movement Type is Tank
is_vehicle_mode Movement Type is Vehicle

Tips

  • Input action not showing up? Define it in Project Settings > Input Map. Built-in ui_* actions are hidden on purpose.
  • “Unset” disables a binding. Good for one-way vehicles or stationary turrets.
  • Accelerated mode uses Forward/Backward Speed as the max cap. Accel values control how fast you get there.
  • The script auto-sets CharacterBody2D motion mode to Floating on start. Required for 360° movement, no config needed.
2 Likes