oh my god i need help?! with jump?!?

Z

zielach

Guest
im trying to do a jump but i messed up a lot with check collision?? and it doesnt work¿¿¿¿ wtf???
and if i dont use check collision i can jump infinite times??????

like rly i didnt want to ask but omg i have been like 3 hours on this and i have no idea¿¿¿
it just doesnt jump even if theres collision with a brick below?????
maybe its because its a circle collision type?? im about to give up right now
i didnt want to use tutorials and stuff for this but man im so tired??

i dont even know if this is the right place to post this¿¿
also my game looks like this

see the ball its the character and it doesnt jump even if i press up... help plss
 
D

DevNorway

Guest
When you press up-key you are checking for a collision above you, and then set vertical speed. Try changing y to 10, instead of -10.
 
Z

zielach

Guest
i tried, and still doesnt work...i also tried with different numbers and nothing..

edit: probably it has to do with this?

but if i dont have that the character falls
 

Llama_Code

Member
It's because your simply checking for a collision with the ground, and if that collision exists set the vertical speed to 0. You will always be colliding with the ground as long as you are standing on it, thus will never be able to jump.

You need to check for the ground below you to stop you from falling through, not just a simple collision.

Use the step event instead so you can check of something is below you to stop you from falling, and jump when you press the up key.
 
L

LV154

Guest
Your code asks game maker to move the player up if there is a collision. Therefore if there is no collision, game maker will not move the player up.

Instead in the step event ask game maker to set the vertical speed to 10 (downwards) unless there is a position_meeting with the ground where the vertical speed is 0. You can then use a variable that is true when the up key is pressed which makes your player travel upwards (ie. Jump)

I'm sure there's other ways of doing it but it's one suggestion
 
Z

zielach

Guest
i have tried so much stuff but things only mess up more could you explain this better or ill completely break my game lol
 
B

BoredMormon

Guest
Your ground check should be relative. If its relative it will check below the object. If its not relative it will check the world position.

This is how my check looks:

Grounded Check.png
 
Top