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.

Newcomers DBPro Corner / How do I make it where I can jump in a FPS game?

Author
Message
Seraf
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location:
Posted: 22nd Feb 2004 20:06
Hello, I am working on a FPS game and I can't figure out how to make it where I can jump when I press Right Click on my mouse?

I have the basic movements of Looking, move up,down,left and right and to shoot the gun.

Could sombody please help?
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 22nd Feb 2004 20:16 Edited at: 22nd Feb 2004 20:16
Jumping is a pretty common question, have you tried searching the forum using the ever handy Search button?
--
TAZ

Seraf
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location:
Posted: 22nd Feb 2004 20:33
Eh, I looked but I didn't find anything that helped..unless I just over looked. The things I found I tried but yet they didn't work..
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 22nd Feb 2004 21:43
Didn't work? Was that the code or the theory? You very rarely can take someone's source code and get it to work. You need to take the ideas and apply it to your own code.
--
TAZ

Seraf
20
Years of Service
User Offline
Joined: 22nd Feb 2004
Location:
Posted: 26th Feb 2004 04:38
Sorry but I've tried all I could think of, I just can't get the thing to jump lol. ::sighs::
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 26th Feb 2004 05:02
Do you have gravity pulling your player down? Jumping in just a big boost in the opposite direction where gravity eventually slow you and then pulls you back down.
--
TAZ

Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 26th Feb 2004 19:35
Or you could use SIN to calculate the players position.


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 26th Feb 2004 22:32
i've never been able to get jumping right! show us how to use sin eb...

In the beginning, the universe was created...
This made alot of people very angry and it has been widely regarded as a bad idea...
Visit http://redeye.dbspot.com
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 27th Feb 2004 00:55


something like that?


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
Saikoro
20
Years of Service
User Offline
Joined: 6th Oct 2003
Location: California
Posted: 27th Feb 2004 01:20
I always noticed that u could have the gravity work like the good ol' parabola graphs in advanced algebra... u know the curvy ones? Heres a little 2d snippet i made that u could maybe apply for gravity in 3d. It needs a ball image, about 50x50 and any color but black. Easy to make in Paint.

-Vash the Stampede

Intel Pentium 4 3.0 Ghz 1024MB Ram NVIDIA GeForceFX 5200 128MB 19" LCD DVI Viewsonic http://www.yobarinteractive.tk
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 1st Mar 2004 20:38 Edited at: 1st Mar 2004 20:44
actually tan could for the gravity acceleration curve, it will just keep increasing, or a quadratic function, i think the quadratic function would quadratic function (y=time_in_air^2 sort of thing) work better because it would keep increasing.

i have made simple jumping functions i'll post one soon but these don'e include the gravity acceleration which i hope to include in my games.

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 1st Mar 2004 20:57
if spacekey()=1 and jump=0
jump=1
endif
if jump>=1 and jump<=60
position camera camera position x(),camera position y()+0.02,camera position z()
endif
if jump >=1 then jump=jump+1
if jump>120 then jump=0

rem Apply simple gravity to camera
position camera camera position x(),camera position y()-0.01,camera position z()

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 2nd Mar 2004 23:20 Edited at: 3rd Mar 2004 01:21
i have finnished my more complex gravity function which also allows for good jumping, look for it in the codebase soon
edit: it includes acceleration as you drop and slowing down vertically when you jump till you start cming down again with the acceleration i have uploaded a demonstration of it [href]www.lochviewwest.plus.com/test.zip[/href]
the top number is whether the player is on tyhe ground, 1 is on ground, 0 is in air
the second number is the jump counter, you don't need to worry about this
the third number is the accelerated speed added on to the initial gravity
the fourth you don't need to worry about

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.
sponge008
20
Years of Service
User Offline
Joined: 8th Feb 2004
Location: MA, USA
Posted: 3rd Mar 2004 03:10
You'd have to do some pretty complex math to get it right...but try searching the Codebase.
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 3rd Mar 2004 18:50
if you want a "complex" method then email me, it's quite simple to include it and i have thought of improvements to the physics of my fnction, do NOT!! use sin because you will probably want to be jumping on uneven ground which will produce odd results if you just use quadratics or triganometry, it's better to put the gravitational and jumping forces in and just let them do it themselves (as seen in the demo i posted)

the code for my "complex" version isn't that complex either

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.

Login to post a reply

Server time is: 2024-09-21 23:50:21
Your offset time is: 2024-09-21 23:50:21