Last active
July 25, 2024 14:13
GBM2K Framework - RPG Maker 2000 Grid Movement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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