Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I haven't tried this yet, but for everyone trying fractional speeds, maybe this code made by ShaunJs can help dealing with this, since you're still moving only in integer intervals

Fractional Collisions / Pixel Perfect - Pastebin.com

Turns out it actually works

var _v = keyboard_check(ord("S")) - keyboard_check(ord("W"));

var _h = keyboard_check(ord("D")) - keyboard_check(ord("A"));

direction = point_direction(0, 0, _h, _v);

if ((_v != 0) or (_h != 0)) {

spd = lerp(spd, spd_max, 0.2);

} else {

spd = 0;

}

spd_final = spd + spd_f;

spd_f = spd_final - floor(abs(spd_final))*sign(spd_final);

spd_final -= spd_f;

movement_and_collision(direction, spd_final, "Walls");


btw, its a fantastic script the one you made PixelatedPope

(1 edit)

So, just FYI, the current beta of GMS2 dramatically changes how collision checks are done.  They are no longer whole number based!!!!  This is actually massively huge.  So fractional speeds no longer really matter anymore.  If your bbox_left is .00001 pixels away from a wall, you aren't colliding.  
What this also means is that "snapping" to a wall with the classic x += sign(hspd) code can be further refined with an "accuracy" multiplier x+= sign(hspd)*.01
Will it slow you down a bit?  Yeah, maybe, but it will make all these floating point errors and jitters go away; possibly for every collision system ever.  Very exciting.

(+1)

I didn't know this until now, it actually sounds really cool. That for sure will solve a lot of issues. Can't wait for it to be fully released. Thanks for the response