Page 1 of 1

Jump problems

PostPosted: Sat Dec 04, 2010 4:33 pm
by Turon
Yvelocity Jumps
Code: Select all
yvelocity=-10;
And as long as I press on the jump key it will always GO UP! and i would like to know how to make a more real like jump.............. anyone's help?

Re: Jump problems

PostPosted: Sat Dec 04, 2010 5:15 pm
by Hblade
Set for "No Repeat", or set for if (var==1) { do_jump; } and when you land on the ground, var=1;

Re: Jump problems

PostPosted: Sat Dec 04, 2010 9:07 pm
by zxcvbnm
Turon I know your excited to start making games but when you 1st came I told you to do my tutorials 1st. Alot of questions you asked are answered there.

Here is the link to the tutorials please read them slowly and you will find life much easier.

viewtopic.php?t=8680&f=4

Re: Jump problems

PostPosted: Sun Dec 05, 2010 5:28 pm
by Kalladdolf
Of course you also need some gravity to make the player fall down again. Draw actor -> yvelocity += 1;
That's the most basic form of 2D gravity.

Re: Jump problems

PostPosted: Tue Dec 07, 2010 5:27 pm
by Turon
Alas! For Kren it did not work! :cry: :cry:

Re: Jump problems

PostPosted: Sun Dec 19, 2010 4:59 pm
by Turon
My problem has been simplified. My problem is that people do give good advise on the jump issue but when i put it in my game it will take in the code, but my player does not get off the ground what is the PROBLEM! :( :( :(

Re: Jump problems

PostPosted: Sun Dec 19, 2010 5:15 pm
by lcl
To make your actor jump, do this:
Your actor draw actor code:
Code: Select all
yvelocity ++;

Key down, the key you want, script editor:
First click variables - add - name the variable jump - click add
Then write this to script editor:
Code: Select all
if (jump == 1)
{
    yvelocity = - 10;
    jump = 0;
}

Then, the most important thing!!!
Collision - top side of your ground actor - repeat:yes - script editor:
Code: Select all
jump = 1;


This works. You don't have to do anything but copy these codes to right places.

Re: Jump problems

PostPosted: Mon Dec 20, 2010 3:24 am
by zxcvbnm
Turon the reason it doesnt work is you didnt declare the variable jump. Jump is not a function you have to declare variable 1st. Thats why your having problems and its not working. Do you know how to declare variables?

Re: Jump problems

PostPosted: Wed Dec 22, 2010 11:41 am
by Turon
You did it! THANK YOU! :D :D :D :D

Re: Jump problems

PostPosted: Thu Jan 06, 2011 3:21 pm
by Turon
Thank you Lcl!

Re: Jump problems

PostPosted: Thu Jan 06, 2011 6:11 pm
by lcl
Turon wrote:Thank you Lcl!

:D