Skip to content

Instantly share code, notes, and snippets.

@Oplexitie
Last active July 25, 2024 14:13
GBM2K Framework - RPG Maker 2000 Grid Movement
func set_direction() -> Vector2i:
# Handles the movement direction depending on the inputs
var direction : Vector2i = Vector2i()
var history_size : int = input_history.size()
if history_size:
if history_size <= 2:
for i in input_history:
direction += MOVEMENTS[i]
match(input_history.back()):
'ui_right', 'ui_left': if direction.x != 0: direction.y = 0
'ui_up', 'ui_down': if direction.y != 0: direction.x = 0
return direction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment