Uploaded January 2013 | Updated November 2026, 3 hours ago
In this tutorial I show how to implement precise collision in Game Maker, enjoy ^)^
NEW Link to file: dropbox.com/s/8jtnfo5hvqscjtv/precise_collision_example.gmk
EDIT: Old ink is broken but I've re-wrote this system in code so it's a lot nicer and doesn't take up to much space. It's basically the exact same thing just in code form :)
You can place the below code in your player's Step Event and instead of different events and it will work (though if you want to separate it you can i.e put the move left code in a keybored left event).
if place_free(x,y+1){gravity=0.7 gravity_direction=270}else{gravity=0 gravity_direction=270} //Gravity
if place_free(x-4,y)&& keyboard_check(vk_left) //Move Left
{
x-=4
}
if place_free(x+4,y)&& keyboard_check(vk_right) //Move Right
{
x+=4
}
Below is the collision code, I've made it so it has to go in a separate collision event with your collision object:
move_contact_solid(direction,12)vspeed=0
If you want it so it goes in your player's step event as well just put this:
if place_meeting(x,y,your collision object here)
{
move_contact_solid(direction,12)vspeed=0
}
In this tutorial I show how to implement precise collision in Game Maker, enjoy ^)^
NEW Link to file: dropbox.com/s/8jtnfo5hvqscjtv/precise_collision_example.gmk
EDIT: Old ink is broken but I've re-wrote this system in code so it's a lot nicer and doesn't take up to much space. It's basically the exact same thing just in code form :)
You can place the below code in your player's Step Event and instead of different events and it will work (though if you want to separate it you can i.e put the move left code in a keybored left event).
if place_free(x,y+1){gravity=0.7 gravity_direction=270}else{gravity=0 gravity_direction=270} //Gravity
if place_free(x-4,y)&& keyboard_check(vk_left) //Move Left
{
x-=4
}
if place_free(x+4,y)&& keyboard_check(vk_right) //Move Right
{
x+=4
}
Below is the collision code, I've made it so it has to go in a separate collision event with your collision object:
move_contact_solid(direction,12)vspeed=0
If you want it so it goes in your player's step event as well just put this:
if place_meeting(x,y,your collision object here)
{
move_contact_solid(direction,12)vspeed=0
}






![Rexplays: Crystal Universe Aftermath - [5]
Hey everyone, how it goin? Welcome to part 5 of my brand new Lets pla...or should I say, Rexplay series of Crystal Universe Aftermath! In this episode, we enter a brand new area, come in contact with new enemies, and even face 2 separate bosses in battle! What could possibly happen next? Find out for yourself in this episode, of rexplays Crystal Universe Aftermath! ^)^
Link to download game: http://sandbox.yoyogames.com/games/79955 Rexplays: Crystal Universe Aftermath - [5]](https://i.ytimg.com/vi/OShtrSl3FK8/mqdefault.jpg)

![Heros Shadow Ep 2 Scene 1 [TEST]
A little test of the opening scene that will appear in Heros Shadow episode 2. I know its a bit sluggish but thats only due to the fact that I had to change the speed of the video. The final result will be much more smooth ^)^ Heros Shadow Ep 2 Scene 1 [TEST]](https://i.ytimg.com/vi/OZhlEwcuCdM/mqdefault.jpg)

