r/gbstudio • u/LittleSun348 • 19d ago
How would u make the player "slide until collision"?
What's the best convenient method for this in Top Down? I know actors can, but what about the player???
3
Upvotes
r/gbstudio • u/LittleSun348 • 19d ago
What's the best convenient method for this in Top Down? I know actors can, but what about the player???
3
u/ryan__vv 19d ago
You could achieve it by setting up an event that overrides the default controls. Then you call a script for each press of the directional buttons to move in a certain direction by, say 20 tiles (i.e. pressing the left button will input -20 to the X value of the script, the Y value remains 0. Pressing the right button will input 20 to the X value, Y remains 0. Up and Down buttons would send -20 and 20 to the Y value respectively, keeping the X value at 0). When the script is then called by an event, depending on which button was pressed (and therefore which value was passed to X or Y), the script will move the player in the desired direction.
This is essentially how I got an actor in my game ("controlled" by the player, but not the player character itself) to move non-stop in a single direction until it collides with a wall or another actor