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 / FPS duck, jump and parallax sky

Author
Message
Gleisner
21
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 11th Jan 2004 03:17
Hi,

I've just run through the Monster Hunter tutorials and browsed the binary moon one. What I want to do is just to get a FPS skeleton going that allows jumping and ducking, where I can take a nice cloud BMP and stick it over the sky, having it move slowly as the player moves. I see no tutorials or snippets for this (or if I've found snippets, I didn't like the way the jump worked or couldn't figure out how to implement it). I'm using a shell of the Monster Hunter and trying to add these abilities. First I'm trying to add duck - should be easy I thought.

I changed the line:
Y# = Get ground height(1,X#,Z#)
to
Y# = Get ground height(1,X#,Z#) + 30
above the Position Camera line to add a little player heighth.
I figured I could just add:
if inkey$()="z" then Y# = Y# - 30
to take the height back away - thus indicating ducking. Since this happens immediately before the Position Camera line, I figured regardless of movement or looking, this would happen. However, I'm only ducking when I'm still - when I move around or use the mouse to look I immediately stand up. I've messed with all the variables in the Upkey(), Downkey, etc sections to try and figure it out and haven't yet.

I have no idea really how to do jumping. I saw one tutorial for it, but the jumps were really floaty and weird and I don't remember where even that tutorial was.

Also I can't figure out player collision in 1st person - in the 3rd person tutorial where it showed how, you had an object to lock into to check for collision. When all you have is a camera, what is the object number? Do I need a phantom invisible object floating in front of me?

Finally, if anyone knows where I can find a code-skeleton for a good FPS that includes jumping, ducking, and maybe shooting more than one bullet at a time (or even throwing out the tangible bullets and just scanning the area to detect a monster, so if monster is standing in front of me, he displays the "hit-by-shotgun" animation and loses life. Since that ended up not being a sentence, I'll finish it by saying if anyone's seen something like this, let me know.

Thanks!
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 11th Jan 2004 08:32
With the ducking, that may be because you are using InKey$() which only alows you to be pressing one key at a time. Try using scancodes.

Also, if you have in your loop
Y# = Get ground height(1,X#,Z#) + 30
then, after it you have
if inkey$()="z" then Y# = Y# - 30

Well, it's not going to work is it?
You are setting the value of Y# at the start, then, changing that value to Y# = Y# - 30 just at the end, then, next loop, it goes back to the original value.

Try changing it so that when "z" is pressed, it sets a variable, then use that variable to set the ground height.

ie


That will allow you to do the crouching effect you are after.


Quote: "Do I need a phantom invisible object floating in front of me"


That's the way it's ussually done... And in that manner, you can get collisions, jumping, and everything, by moving the object, and posisionig the camera where the object is.

For Jumping, there are so many different ways of doing it... You just have to figure one out for yourself really ( best way to learn ) If you can't, however, have a look in the codebase.


Quote: "shooting more than one bullet at a time "


Search the forums for "Machine Gun" or somethign along those lines, and have a look at the thread started by Northen_Fist cos I did a good example of multiple fire in there.


Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Neil Young
21
Years of Service
User Offline
Joined: 6th Jan 2004
Location:
Posted: 12th Jan 2004 00:44 Edited at: 12th Jan 2004 00:45
I am making a space game, and to do the stars, I put a star texture on a large sphere. You could do the same, only with clouds and such. Setting the object's cull property to 0 (active) will allow you to see the texture while inside the sphere. Then just use the Scroll Object Texture command to move the textured sky as if it were moving, you could even have half of the texture be night time to simulate a night/day cycle.
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 12th Jan 2004 04:38
@ Neil Young

Sorry, you really should have made your own post on that topic. If you post in this thread, it must have some relevance to the author's message (Gleisner's in this case). I will say that spheres are a bad idea - use boxes instead.

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 13th Jan 2004 08:42
um.. didnt he ask for help on how to do a scrolling sky

Quote: "What I want to do is...where I can take a nice cloud BMP and stick it over the sky, having it move slowly as the player moves."


or am i missing somthing myself?

and with collision just make a object u dont see like u said
Gleisner
21
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 18th Jan 2004 04:18
Thanks guys,

I'll try the invis. object and the sphere/cull=0/scroll object stuff for collision and sky, but I used the code for ducking, and replaced inkey$ with scancode() = 44 or scancode() <> 44 for crouch, and it still stands up when I walk.

Here's your insert and what I did with it.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Jan 2004 05:41
If you're using a model, then it will still stand up, you need to animate it into a crouching position, and change the animation position when you press the crouch button.

But, if that's not what you have, and the object isn't moving down at all, then I really don't know what's wrong with the code, sorry.

Maybe you are reseting the Y# value again after that code, which you shouldn't, cos that means that Y# is set back to the ground height, rather than ground height - 30.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-22 14:24:30
Your offset time is: 2025-05-22 14:24:30