• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Fall collision

Chaser

Member
Having some teething issues, can't quite get my head around it, so looking for some pointers.

my character has an idle state, press jump button, when 'falling' the sprite changes to 'Fall state' with a 'Fall sprite'.
the fall state runs a script to change back to idle when the collision (hitting the floor) happens.

Now, my code works but only if my mask is nearly full, but when i change the mask to something shorter the code doesn't work, and cant figure out why? i wouldn't expect the mask to change the expectation of the collision, origin yes, which all sprites are set to 0,0. so perhaps it does? or am i missing something, an explanation would be great so i can think of a work around. the reason im changing the mask because i have a floor above the character and it keeps getting stuck in it. :)

thanks in advance. :)
 

Attachments

Simon Gust

Member
If your vertical speed is greater than the height of a block plus the height of your collision mask, you will fall through the floor some of the time.
Your collision code does not work well with high speeds and small masks.
I suggest leaving the mask always the same, that way you shouldn't get stuck anywhere. And also always leave the origin in the same place, preferably in the bottom center.
 
R

robproctor83

Guest
I'm not 100% sure about this on platform style games, but I would still think that your sprite origins would be at the base (the feet) and not 0,0.
 

Chaser

Member
If your vertical speed is greater than the height of a block plus the height of your collision mask, you will fall through the floor some of the time.
Your collision code does not work well with high speeds and small masks.
I suggest leaving the mask always the same, that way you shouldn't get stuck anywhere. And also always leave the origin in the same place, preferably in the bottom center.
I see, i didn't realise that, just thought the step event would catch it regardless of the speed. does that mean if your game is super fast you will need a different sort of collision and bigger masks then? interesting. my jump speed doesn't go any higher than 16, with the gravity -1. its not super fast., i get what your saying, the sprite is 'Passing through' the collision object, but i thought the step event (script) should be catching that right. it is a platformer im working on. I'l keep it full image, but this is going to cause me other collision issues elsewhere, the origins are default, but i guess i could change those to the bottom, but i tried that and had the same. i appreciate the answer, its given me much to ponder over the collision events. :)
 

Simon Gust

Member
The step event runs room_speed amount of times per second and it can't magically detect collisions faster than that.
If your game runs super fast as in room_speed it can actually work with smaller masks. If your game runs fast as in just movement of the player but at 30 fps, you will need bigger masks, or a better collision system.
It's like reflexes, you're trying to catch a car going at 800km/h vs catching a train at 800km/h, which one do you think you'd rather see running by?
Now if you have super-human reflexes that are twice as fast, you would have a lesser problem catching even a bycicle gong that fast.
 
Top