BlocosIA Wiki Editor

8-Direction Movement

Move with the arrows in 8 (or 4) directions with acceleration and deceleration, like Construct 3. Great for top-down games.

Just use "use 8-direction movement: yes" on the green flag: the arrows already move the sprite (no "forever" needed). Speeds are in steps per second. The sprite does not pass through barriers or solid map blocks. For on-screen controls or AI, use "controls: none" and "simulate key" inside a "forever".

To use it: in the editor, click "Extensions" (bottom corner) and add "8-Direction Movement".

Stack

use 8-direction movement: [yes]

Turns on 8-direction movement: the arrows move the sprite by themselves, with acceleration and braking.

Stack

max speed ( ) acceleration ( ) deceleration ( )

Max speed, acceleration and deceleration, in steps per second.

Stack

set [max speed] (8 directions) to ( )

Changes just one setting (max speed, acceleration or deceleration).

Stack

allowed directions: [8 directions]

8 directions, 4 directions (good for mazes), up/down only or left/right only.

Stack

turn the sprite to where it moves: [free (360°)]

Whether the sprite turns to where it moves: free, every 45°, every 90° or not at all.

Stack

controls: [arrow keys]

Which keys move the sprite: arrows, WASD, both or none (to control with blocks).

Stack

stay inside the stage: [yes]

Keeps the sprite inside the stage.

Stack

simulate key [left]

Pretends a key is pressed this frame. Use inside a "forever" for AI or on-screen buttons.

Stack

ignore controls: [yes]

Makes the sprite ignore the keyboard (e.g. during an animation).

Stack

stop now (zero speed)

Sets the speed to zero right away.

Stack

reverse the movement

Reverses the speed (like bouncing).

Stack

set [x] speed to ( )

Sets the x or y speed (steps per second). Good for knockbacks.

Hat

when I hit a wall

Starts when the sprite hits a barrier or a solid map block.

Reporter

speed (8 directions)

The current speed, in steps per second.

Reporter

[x] speed (8 directions)

The x or y speed.

Reporter

moving direction (8 directions)

Where the sprite is moving, in degrees.

Reporter

[max speed] (8 directions)

The value of max speed, acceleration or deceleration.

Boolean

am I moving (8 directions)?

True while the sprite is moving.