GML Visual When holding up on ceiling, can fly

H

homeyworkey

Guest
So, if my character is colliding with block_object, variable jumpfloor is set to 0. When you press the jump key, jumpfloor is set to 1. This makes it so you can't double jump etc. However, if I hold the up key on this block object the jumpfloor is obviously always set to 0. So if I am holding jump, jumpfloor is set to 0 until you let go of the jump key (and you can just fly if you're connected to the ceiling/bottom of the block_object)
Unsure how to make it detect if it's at the bottom of the object, any ideas?

By the way: I use the blocks, not code so please don't post in code as I most likely can't use the advice effectively (if at all)
 

NightFrost

Member
Set jumpfloor back to zero in the vertical collision check only when your vertical speed is larger than zero (that is, the character is falling).
 
H

homeyworkey

Guest
Set jumpfloor back to zero in the vertical collision check only when your vertical speed is larger than zero (that is, the character is falling).
For clarity, with the last part of the sentence do you mean when the character is detecting vertical collisions with the block, only set jumpfloor to 0 if vertical speed is larger then zero? If so, I'm not sure how to detect the vertical speed. (Is it vspeed? Or is it something else?) If so, then I should be fine in that regard.
However, on another regard- I don't know how to check if the character is colliding vertically with the block. Can you show screenshots?
I might have completely misread this and you're saying something else? Not sure. Thanks
 
X

XirmiX

Guest
Collision is handled by checking whether the pixel in the next position is part of an instance of the object type that you would check, or that's how I understand it at least. So, to check if collision at 1 pixel below your object is colliding with your desired object:
upload_2018-7-19_15-32-38.png
If you're using physics, however, that would be a whole different story. Handling physics is harder, but collision detection for the most part is done for you of course.
 
H

homeyworkey

Guest
Collision is handled by checking whether the pixel in the next position is part of an instance of the object type that you would check, or that's how I understand it at least. So, to check if collision at 1 pixel below your object is colliding with your desired object:
If you're using physics, however, that would be a whole different story. Handling physics is harder, but collision detection for the most part is done for you of course.
and would this be in the step event for the character_object, or in the object_collision event? Tried it earlier and remember it didn't work sadly
 
Top