• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - GML Visual I am entirely new to gamemaker, how do i do collisions correctly?

M

Mark Robuck

Guest
I have been working for hours and hours trying to make a simple platformer base, but nothing has been working! Whether it be that I slowly fall through the floor, or something else it never seems to work right. I make gravity by set a relative speed of 1 on the vertical axis on the step event, if its not colliding with anything. Then if it is colliding with something, I set the speed to -1 on the vertical axis, then jump to point -.01. This barely works, and I know I cant make an acceptable game with this. Could someone help me? I cant find any good tutorials on drag and drop for studio 2 anywhere, and I really tried my best to figure it out on my own. I'm sorry that I contribute to the 💩💩💩💩loads of collision posts here ;-;


 

csanyk

Member
I would suggest, rather than starting straight away with trying to make a platformer game, that you work your way up to that by building some simpler games first.

If you really want to do a platformer, there are tutorials out there, but I don't know of any that would show you how to do it using DnD.

There was a really excellent (though now outdated) book called The Game Maker's Apprentice, and it had a sequel The Game Maker's Companion. Written for GM8, it used DnD actions for most if not all of the examples, if I remember well. Worth picking up if you can find it, even today. I believe much of the DnD system from back then is still relevant.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
There was a really excellent (though now outdated) book called The Game Maker's Apprentice, and it had a sequel The Game Maker's Companion. Written for GM8, it used DnD actions for most if not all of the examples, if I remember well. Worth picking up if you can find it, even today. I believe much of the DnD system from back then is still relevant.
Please do NOT recommend these books! They are way too out of date, and while with GMS1.4 it was fairly easy to update the content to the version, with GMS2 that is almost impossible. Those books will simply confuse and frustrate new users, as the IDE (and in particular DnD) is very, very different. Better to suggest the manual and youtube videos for now (until a decent GMS2 book comes out. :) )

As for the issue... Why are you setting the speed to -1? When the player detects a collision beneath it, you should set vertical speed to 0 and gravity to 0 too. Only set gravity when the player has nothing underneath it. So you'll want to have a step event with a check collision action something like this:

upload_2017-4-4_7-48-44.png
 
M

Mark Robuck

Guest
Please do NOT recommend these books! They are way too out of date, and while with GMS1.4 it was fairly easy to update the content to the version, with GMS2 that is almost impossible. Those books will simply confuse and frustrate new users, as the IDE (and in particular DnD) is very, very different. Better to suggest the manual and youtube videos for now (until a decent GMS2 book comes out. :) )

As for the issue... Why are you setting the speed to -1? When the player detects a collision beneath it, you should set vertical speed to 0 and gravity to 0 too. Only set gravity when the player has nothing underneath it. So you'll want to have a step event with a check collision action something like this:

View attachment 8422
Thank you! I will try that when I get home today, I wasn't even using gravity at all, the setting of the speed was my gravity. It's so great to find someone who can help you!
 

csanyk

Member
Please do NOT recommend these books! They are way too out of date, and while with GMS1.4 it was fairly easy to update the content to the version, with GMS2 that is almost impossible. Those books will simply confuse and frustrate new users, as the IDE (and in particular DnD) is very, very different. Better to suggest the manual and youtube videos for now (until a decent GMS2 book comes out. :) )View attachment 8422
I agree that the manual and YouTube are good, but almost all YouTube tutorials for GameMaker ignore DnD, and these books, while dated, do a very good job of explaining the basic concepts and how to navigate the GM8 IDE. The GMS1.x IDE isn't so different, but yeah the GMS2 IDE is quite different. Still there are a lot of fundamental concepts that are common to all versions of GM.

Someone should talk to the publisher about updating the books for GMS2 -- anything written as clearly as these were would be a great asset to newbie GMS2 users.
 
Top