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.

DarkBASIC Discussion / How can i Make The Player Jump?

Author
Message
qkzkfk010
8
Years of Service
User Offline
Joined: 13th Jul 2016
Location:
Posted: 13th Jul 2016 06:33
How can i Make The Player Jump?
highwind
16
Years of Service
User Offline
Joined: 4th Jun 2008
Location: france
Posted: 21st Jul 2016 22:58
U mean the player sample in the training class?
feel free to visit my web site
highwind
16
Years of Service
User Offline
Joined: 4th Jun 2008
Location: france
Posted: 21st Jul 2016 22:59
U mean the player sample in the training class?
feel free to visit my web site
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Jul 2016 23:05
It depends on how you handle collision, ideally you want to know if the player is already in the air or if they are touching the ground. Any jump routine tends to involve physics, and that means you need velocity variables for your player, hopefully you already have that. The Y velocity should decrease over time, and if the player collides then that can be set to a small negative number, it's not always good to set it to 0, better to keep it hitting the collision.

So you need to have X Y and Z velocity, or just X and Y for 2D, and apply these to the player position, and adjust them for gravity and player control. If you detect a collision then there are different methods, but an easy example would be a matrix or terrain, where there's usually a convenient command to return the ground height.

Then, if the player is touching the ground, and the jump button is pressed, you set the Y velocity to a positive number, which sends the player up in a nice arc, as the Y velocity is reduced to negatives as gravity takes over.

Lots of factors involved, probably best to give more details or post code.
The code is dark and full of errors
Alex Deef
10
Years of Service
User Offline
Joined: 8th Apr 2014
Location: eastern europe
Posted: 29th Sep 2016 13:03
Can you post your code?
http://www.pishop.de/Cialis.html
http://www.achetermed.fr/Levitra.html
ninik11
7
Years of Service
User Offline
Joined: 29th Nov 2016
Location:
Posted: 29th Nov 2016 00:52
how to get players this

Login to post a reply

Server time is: 2024-11-17 22:32:38
Your offset time is: 2024-11-17 22:32:38