viewing paste Simple Collision Code | GML

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13
// if there is a collision with anything solid, bounce off of it
 
if (hspeed != 0) {
    if !place_free(x + hspeed,y) {
        move_bounce_solid(true);
    }
}
 
if (vspeed != 0) {
    if (!place_free(x + hspeed,y + vspeed)) {
        move_bounce_solid(true);
    }
}
Viewed 586 times, submitted by Guest.