Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Jump problem

Author
Message
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 5th Dec 2010 21:28
When I run the code the ball just goes down and doesn't stop.
the balls initial y is 23.



Forward thanks.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 6th Dec 2010 11:37
You should put a manual stop to your y_fSpeed variable:

Also, in the line
Quote: "if (jump=true && dbObjectPositionY(ball)<=maxheight+2)"
the jump=true should be jump==true. There's a big difference between = and ==. And, any bool can be expressed in an if or while statement like:
if (jump){....}
while (jump){....}
or use the ! (not) for a condition with false.

The fastest code is the code never written.
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 6th Dec 2010 15:04
Thanks, i'll try it.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 7th Dec 2010 02:34
The best way to do this would be to use sparky's to detect when you've hit a floor after the jump, then stop the decrease of the Y position variable.
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 7th Dec 2010 20:35
I have modified it to this and when i press space it jumps and then it falls down.
I have tried sparky but when i set the collision with the ground it doesn't let me go over it.
I included the whole "game" project.
What should I do, should I use sparky?
Forward thanks.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-06-28 01:44:28
Your offset time is: 2024-06-28 01:44:28