GameMaker Any *real* guides for top down collision out there?

S

SayBaconOneMoreTime

Guest
Hi there,

So I am to the point in my programming journey where I acutely feel the need for more control over how my collisions behave, but I am not smart enough to code my own system and feel good about it. I have been using the physics engine, and the more I try to do interesting things with it, the more it messes with me. It handles the basics well, but it doesn't do everything I need it to. However, I would like something very much like it: i.e., different objects have different densities, which allows me to make some things which function as hard walls that the player and other mobile instances cannot move period, whereas other things, like say, a crate, can be pushed around to create interesting puzzles. I also like the fact that the physics engine allows me to define the collision box of an object in the actual object editor, and that it handles momentum and bouncing off walls and whatnot for me.

Despite this, there are still several things about the physics system I do not like. I don't like having to move things around with forces and such. For projectiles, this works wonderfully, but for the player, far less so. I also don't like that collisions cannot be easily turned off based on instance state. In addition, I can imagine some circumstance in which having different collision areas for a single instance would be helpful (i.e., a boss which touching any side of it will damage the player, but only strikes directly to the eye will damage it, a la Zelda).

I have browsed YouTube tutorials a fair bit in my early days, and I do not recall any collision tutorials that did not either say "just use the physics engine and voila it works" or only lay the very basics for collisions (i.e., this thing is wall, this thing is player, move player into wall, player does not go into wall, yay). Is there anything on the YouTubes that I have not located, or anything on the forums, or any resources on 2D collisions in games as a whole, or what? I'll be looking for resources myself, but I would really like someone who knows their stuff to point me to something that is powerful enough for me to mess with and tailor to my game, as while I am not smart enough to code a whole collision engine from scratch without any assistance, I think I would be capable of tweaking what I have been taught to understand.
 
M

Meowanator

Guest
This playlist, mainly episodes 1&4, has an amazing collision system that I love.
 
M

Matt Hawkins

Guest
The physics engine can be tricky to work with, that maybe why there arent as many tutorials that use it.
However it is relatively easy to do all the things you mentioned with the physics engine
different objects have different densities, which allows me to make some things which function as hard walls that the player and other mobile instances cannot move period
If you set an objects density to zero and make that object kinematic, you can move that object by setting its phy_speed, this will allow the object to move but not be affected by other forces like the player pushing it.
. In addition, I can imagine some circumstance in which having different collision areas for a single instance would be helpful (i.e., a boss which touching any side of it will damage the player, but only strikes directly to the eye will damage it, a la Zelda).
This can be achieved by joining physics objects together using physics_joint_weld_create. This allows you for instance, to put an invisible object where the enemy's weak point is to register damage.
 
Top