Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (frutza, Quad, AndrewAMD), 385 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367647
04/16/11 02:03
04/16/11 02:03
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Your approach is to directly influence a distance vector and move the player according to that vector. That is a very simple approach. Another simple yet much better looking approach is to work with forces and speeds.

It basically goes like this:
1. Assemble a force vector - basically the way you already did by checking if the wasd or arrow keys are pressed and adding an extra boost for the shift key. But this time you do not multiply with time_factor.
2. Do an extra check for the players height. Is the player a certain distance over the ground? If so then apply gravity, i.e. a force downwards. If not, well, then check if the jump key is pressed and if so add an upwards force.
3. You have got a second vector called speed. Initially all speed components are zero. Now you can accelerate the current speed by the force vector you just assembled. You get a current speed and can move your player by this speed vector.

For accelerating you can use the function vec_accelerate. That is still relatively simple, but the results should be much better. Does that give you the idea what to do next?


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367648
04/16/11 02:12
04/16/11 02:12
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
yes it does. i will try to start on this now. i think i have done number 2 in handle_gravity. is that where i should put the jump code then?

ill have to research how to assemble this. haha. but its clear what i need to do.

when i assemble the force vector, dows that mean i redo handle_movement?

Last edited by Doc_Savage; 04/16/11 02:12.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367690
04/16/11 18:09
04/16/11 18:09
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: Doc_Savage
is that where i should put the jump code then?

Either there or in handle_movement. Note that you don't have to write absolute values into variables. For instance if you detect the player is in the air you can also subtract a value from the force vector like: "force.z -= 9,81;". You only have to pay attention then, that you reset the force vector after every acceleration of the speed vector.

Originally Posted By: Doc_Savage
when i assemble the force vector, dows that mean i redo handle_movement?
Basically yes. You can keep the base idea of handle_movement but have to do some changes there...


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367705
04/17/11 00:55
04/17/11 00:55
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
ok ill be honest. i have no idea how to do that.. lol.. just wasnt covered in the workshops and there are no tuts. maybe i can request one in the tutorials section...

Last edited by Doc_Savage; 04/17/11 01:12.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367707
04/17/11 02:24
04/17/11 02:24
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Just tell me where exactly your problem is and maybe I can give you a kick off. :-)


Always learn from history, to be sure you make the same mistakes again...
Re: simple jump code needs some tweaking... [Re: Uhrwerk] #367708
04/17/11 02:29
04/17/11 02:29
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
i need to know how to create a whole new REAL jump code. thats pretty much it. one with forces and all that stuff you told me.

im so dumb lol.

Last edited by Doc_Savage; 04/17/11 02:34.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367719
04/17/11 04:43
04/17/11 04:43
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
You need to learn how to play a bit more when making games. Try this, have your jump keep happening even if you dont let go of the key. This way you can see how long it takes for the player to get off the ground. If it is to much or too little. Put more "god like" controls such as this when you are debugging and you figure this out a lot faster.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: simple jump code needs some tweaking... [Re: FoxHound] #367720
04/17/11 04:48
04/17/11 04:48
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
ive gotten to this stage beleive it or not. now how can i cause the code to stop a certan amount of time after i press the key?
(and basically have to press it again to jump again)
i know theres got to be some sort of code word to do it. i tried the wait(1); one, but it just dosent seem to work.

see, im more of a game artist not a tech guy. but i want to learn both laugh


i am quite happy with the discoveries ive made though, ive given my player the ability to regenerate health, as well as a GREAT death code. i love learning new things. im sorry to see the workshops only ended with 25 smirk

Last edited by Doc_Savage; 04/17/11 15:21.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Re: simple jump code needs some tweaking... [Re: Doc_Savage] #367755
04/17/11 17:02
04/17/11 17:02
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
Don't feel bad. Jumping is one of the hardest "easy" things to do in a game. It also what usually marks when someone can call themselves a programmer. Because you have to look at something from real life and mimic it.

When you Jump you put upward force on your body. The entire time gravity is working against that force, even when you are going up. What is happening is gravity is reducing that force amount until it becomes zero. That is the top of your jump. Then you fall back down. But what seems to be missed is that at the start of your jump you are moving the fastest. At the end of your jump when you hit the ground you move the fastest. So for once instance at the height of that jump, from when you go from moving up to moving down, you are motionless, suspended in air.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: simple jump code needs some tweaking... [Re: FoxHound] #367782
04/18/11 01:45
04/18/11 01:45
Joined: Jan 2010
Posts: 145
Doc_Savage Offline OP
Member
Doc_Savage  Offline OP
Member

Joined: Jan 2010
Posts: 145
i cant figure out a darn thing. im too stupid to figure this out. no matter what i cant get past using dist.z = 5; NOTHING ELSE WORKS im getting very irritated. cant SOMEONE let me know how to start making a REAL jump code? im deleting everything i have on jump (a whopping 3 LINES!!! WOOHOOO SO MUCH WORK!) until i can understand what you guys are talking about. ive tried putting in speed, force, vec_accelerate NOTHING FRIGGIN WORKS AT ALL and theres no tutorials on this! theres NOTHING about jumping in the workshops, the manual. OR the aum magazine! ive even looked at past posts about jump code but i cant make heads or tails of it!! I SUCK!!!!

Last edited by Doc_Savage; 04/18/11 06:45.

Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
Page 2 of 3 1 2 3

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1