• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Jaggy diagonal collision (when with Gamepad)

R

raindev04

Guest
Hello there! I have an issue that kept me in front of the PC for 2 days long..

I have a simple gamepad-based movement in any direction.
Basically it is something like that:

Code:
horComp = gamepad_axis_value(0, gp_axislh);
verComp = gamepad_axis_value(0, gp_axislv);

// after some unimportant controls...

if (place_free(x+(sign(horComp)*spd),y)) {
      x += horComp*spd;
}
if (place_free(x,y+(sign(verComp)*spd))) {
      y += verComp*spd;
}
And it works perfectly fine with any collision whose mask is squared/rectangled. BUT for collisions (precise) in diagonal, the animation looks so jaggy.. I use only square/rectangle collision mask and half squares like that:



Nothing more. But with those, I have some issues.
I don't know how to explain it better, but I wonder if someone could give me some tips on how I can concern with that.. Obviously if you didn't understand something, just ask and I'll try to explain better.

Thanks in advance!
 
D

Dibidoolandas

Guest
Shaun Spalding did a great tutorial on how to account for slopes. You will have to revamp your code but I seriously recommend checking it out, it'll be much more robust after this.
 
R

raindev04

Guest
Shaun Spalding did a great tutorial on how to account for slopes. You will have to revamp your code but I seriously recommend checking it out, it'll be much more robust after this.
Well for slopes in platform it's pretty easy, and I did it all alone without that video..
But for checking in any direction, the difficulty increases.

EDIT: well I though that viewing again that video was worth.. and I was right, like a stroke of a genius (not me obviously lol) I understood where I was wrong.
I implemented it and I KINDA resolved, but now I know how to move..

So thank you kindly! :)
 
Last edited by a moderator:
Top