Hey, so I'm making a top-down rpg and i want smooth diagonal collision, as seen in A Link to the Past, or any similar rpg game tbh.
I've heard that the best way was using a velocity and subtracting how much you moved from how much you would have moved, but i dont rlly understand that, I cant find any tutorials, plus I'm moving my character by a speed, and looping for each pixel, and not even using a velocity.
So I was wondering: could I just mark diagonal tiles as similar to solid, but give them individual physics, based on the diagonal type and your direction?? Or would my best bet just be adding velocity?
Thanks in advance if anyone sees this!!
Diagonal RPG Collission!!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- BrotSagtMist
- Party member
- Posts: 657
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Diagonal RPG Collission!!
What is your collider code anyway?
How is your map structured? Tiled, free?
How is your map structured? Tiled, free?
obey
-
- Party member
- Posts: 356
- Joined: Wed Jul 03, 2013 4:06 am
Re: Diagonal RPG Collission!!
Velocity is a fancy word for speed, basically, lol.
Re: Diagonal RPG Collission!!
Speed is the time rate at which an object is moving along a path, while velocity is the rate and direction of an object's movement. It's not the same, velocity is a vector.
-
- Party member
- Posts: 356
- Joined: Wed Jul 03, 2013 4:06 am
Re: Diagonal RPG Collission!!
I was making a joke, that's all, riffing on the literal dictionary definition of velocity
Either way, I don't think you need velocity to do diagonal movement and diagonal collision, you just need to check both future x and y and not just one or the other...
Either way, I don't think you need velocity to do diagonal movement and diagonal collision, you just need to check both future x and y and not just one or the other...
- BrotSagtMist
- Party member
- Posts: 657
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Diagonal RPG Collission!!
yee the usual way is just saving the position to a temp value, apply the movement, check if we are in a wall, and if we are just revert to the save.
obey
Re: Diagonal RPG Collission!!
This approach does work, though it does mean you'll never be right up against the wall, and means you sort of 'stick' to the wall so you can't slide against it when moving at an angle into it.BrotSagtMist wrote: ↑Wed Jun 21, 2023 6:47 pm yee the usual way is just saving the position to a temp value, apply the movement, check if we are in a wall, and if we are just revert to the save.
A more advanced approach is to move the player to a position on the line of movement that is exactly against the surface of the wall, that way you get right up close to the wall. (Granted, this version only solves the first issue)
Dragon
Re: Diagonal RPG Collission!!
I am using the system:
Check the movement. If ok, then do the movement else don't do the movement. It's very universal and simple for realization.
Check the movement. If ok, then do the movement else don't do the movement. It's very universal and simple for realization.
- BrotSagtMist
- Party member
- Posts: 657
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Diagonal RPG Collission!!
Yee, it works fine for rpgs, but bobble has a point, any physics simulation with gravity and you get a weird floating motion above obstacles
Then well need our freaking movement vectors.
Then well need our freaking movement vectors.
obey
-
- Party member
- Posts: 356
- Joined: Wed Jul 03, 2013 4:06 am
Re: Diagonal RPG Collission!!
Okay, yeah, that's true. For not sticking on walls movement vectors are hella important
Who is online
Users browsing this forum: Bing [Bot] and 5 guests