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 / Problems with code, need help adding realism

Author
Message
Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 13th Apr 2004 16:31
Ok, I posted the main loop in with this post, here are my problems, how would I go about making an object strafe (this one is probably easy to answere.)

My second problem is I have no height recognition for my terrain, how would I add it for an object.

My third problem, when jumping you can jump an unlimited ammount of time making it possible to fly, how do I limit this to a certain height.

And finally my third problem, how do I position the follow camera higher up than the box? The game im working on is a mech game so they have to stand fairly high.

Im not asking for someone to write the code for me, im asking someone to help me learn how to write codes for these subjects.

Thx much,
Zero

Zero (Formerly Shadow Guyver)
NRTP Message Boardshttp://nrtp.proboards22.com/index.cgi
Terra Elysium (A Megaman Fanclub)http://terraelysium.proboards28.com/
MikeyP
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Manchester, UK
Posted: 13th Apr 2004 16:44
One effective way I get my objects, cameras to starfe is on a key press I rotate the object/camera 90 or -90 depending on which way you'd want to strafe then i'd use the Move Object command to go however far that way and then do either 90 or -90 [The opposite of the one before] to return the player to the original angle.
Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 13th Apr 2004 17:03
Ok I made something like this...



Ive also tried it with all directions x y and z, and I still dont get good results. It either moves me forward, up, or makes me do a 180. Any idea to why its not working?

Thanks,
Zero

Zero (Formerly Shadow Guyver)
NRTP Message Boardshttp://nrtp.proboards22.com/index.cgi
Terra Elysium (A Megaman Fanclub)http://terraelysium.proboards28.com/
MikeyP
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Manchester, UK
Posted: 13th Apr 2004 17:47
Oh sorry I probably should of mentioned a few points.

The object should be rotated on the Y axis.
Well heres some source code I've taken out of my current project as an example.



The code moves a camera instead of an object but the basic idea is the same.
Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 13th Apr 2004 18:09
Hmmm, I tried it with just a camera, and the code made a 90 degree turn and faced me in that direction, any clue why this is going on?

Ill post my new code in the source again...

Thanks,
Zero

Zero (Formerly Shadow Guyver)
NRTP Message Boardshttp://nrtp.proboards22.com/index.cgi
Terra Elysium (A Megaman Fanclub)http://terraelysium.proboards28.com/
MikeyP
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Manchester, UK
Posted: 13th Apr 2004 18:24 Edited at: 13th Apr 2004 18:24
YRotate Camera() does rotate the camera by that amount it rotates it to that ammount so, Your code should be....

Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 13th Apr 2004 18:28
Thanks, now I get it, I hope I wont make this mistake during the future, anyone know of how to solve my other problems and can teach me what exactly is wrong and what exactly its supposed to be?

Thanks again,
Zero

Zero (Formerly Shadow Guyver)
NRTP Message Boardshttp://nrtp.proboards22.com/index.cgi
Terra Elysium (A Megaman Fanclub)http://terraelysium.proboards28.com/
muscles
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location:
Posted: 13th Apr 2004 21:11
ok, there's a little bit involved with your questions, so forgive me if i don't remember all the code exactly. firstly, most of your questions can be answered in the monster hunt tutorials, look there for things like strafing. here's my exact code for strafing from one of my fps.
IF KEYSTATE(30)=1
x#=newxvalue(x#,wrapvalue(angy#-90.0),2.0)
z#=newzvalue(z#,wrapvalue(angy#-90.0),2.0)
ENDIF
keystate(30) is the "a" key. the x# is the player coordinate. newxvalue generates a new x-coordinate value for a position from a given point and angle. basically, you enter the current position, enter the angle to move (which in this case is angy# - 90 degrees, or directly to the left of the camera angle), and the final parameter is the distance to move. see if that works out for you.
muscles
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location:
Posted: 13th Apr 2004 21:13
for your second question:
if by height recognition you mean that your mech walks through the matrix instead of over the top of it, you need to use the "get ground height command". syntactically, it goes as follows:

y# = get ground height(matrix number, x position, y position)

then reposition your character at its given x,y,z coordinates
muscles
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location:
Posted: 13th Apr 2004 21:22
i'll get to jumping in a minute. as for your camera problem, don't use the default follow camera command. instead, position the camera at a point behind the player and adjust it to whatever height you want, then tell the camera to always point at the player. (you'll need to use newxvalue and newzvalue commands)
for example
camy#=y#+50 (or however high you want your camera to be above your mech)
camz# = Newzvalue(z#,angy#-180,camdist#)
camx# = Newxvalue(x#,angy#-180,camdist#)
position camera camx#,camy#,camz#
point camera (x#,y#,z#)
muscles
20
Years of Service
User Offline
Joined: 12th Apr 2004
Location:
Posted: 13th Apr 2004 21:23
as for jumping, i assume that you already have gravity in effect. all you need is a simple control variable, set to 0 or 1. if they hit the jump key, set the control to 1 and put an if statement restricting further jumping until the variable equals 0. when they return to the ground, set the variable equal to 0
Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 14th Apr 2004 22:28
Ok, so how about camera jumping, how is that done? Is it done with camera position y or something?

I decided to go with the good old fassioned camera movement for a start, and I have no clue how to bring about jumping.

Thanks,
Zero

P.S. Before I was using the code that yellow sent me a link to.

Zero (Formerly Shadow Guyver)
NRTP Message Boardshttp://nrtp.proboards22.com/index.cgi
Terra Elysium (A Megaman Fanclub)http://terraelysium.proboards28.com/

Login to post a reply

Server time is: 2024-11-26 12:50:41
Your offset time is: 2024-11-26 12:50:41