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 / go sub player straffing

Author
Message
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 12th Mar 2009 22:21
Hi er yes I can't seem to get the player to straffe in the 1st person using this damn go_sub commands try as I might I have ripped these command several times out but to no avail can anyone help me please?

Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 12th Mar 2009 22:25
Well, instead of turning and re-turning, why not just



For strafing left.

What exactly is your problem with gosub?

~QJ
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Mar 2009 22:55
Turning and re-turning is good because you can strafe from different angles, not just running on the X coordinate. Granted, I would DEFINITELY suggest using trig (I always do) but if you don't know the trig or can't make the trig work, turning and re-turning will work, I have done it before.

@Vampyre
Can you repost with the relevant pieces of the code? I am not exactly sure where to look and my laptop battery is almost dead...

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 12th Mar 2009 22:59
Quote: "not just running on the X coordinate"


Hmm, didn't think about that.

~QJ
That's what they WANT you to think...
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Mar 2009 23:02
Neither did I at first...then I wondered why my character was going the wrong direction

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 13th Mar 2009 00:41 Edited at: 13th Mar 2009 00:45
Well Quirkyjim I want the babe model to straffe in the first person as well as the third person, not all of it is my code as I didn't know the joy hat commands and got shown that by Vice ,also didn't know the cammode command and got shown by Jess Ticular and the go_sub commands are not me just the joystick and keyboard commandsare mine. The _Move player commands are not mine, they are Chris Montgomery's am just getting go_sub, still for some reason I can straffe in the third person but not in the 1st and I want both, I have the straffing both in 1st and 3rd for a different program I wrote but I don't ue the go sub routines and I have been thinking of using functions instead

I wonder would they work better than the go sub routines?
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 13th Mar 2009 00:45
For BN2 Productions


Here is the relevant code BN2
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Mar 2009 02:59
What controls the strafing? Also, as a general tip: It usually isn't advisable to copy someone's code and use it. Not because they may want credit (which is true as well) but mainly because you won't understand the specifics of how it works. Now, if you look at someone's code, figure out what makes it tick, then re-create it, that is great, because then YOU know how it works and how to manipulate it.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 13th Mar 2009 04:28 Edited at: 13th Mar 2009 04:29
We were working on the code together BN2? Still what you say is quite true anyway it is the a and d keys and the left and right arrow keys
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 14th Mar 2009 00:09
i wouldnt use gusub in this situation, i would check to see if he should be strafing (use if command to see if left/right key or joystick pressed) then use something like this for right:



or left:



have bn2 or some1 un this thru DB to make sure it works cuz i made it off memory without DB so i prolly overlooked something
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Mar 2009 01:41
There are a couple of helper functions that come in real handy when trying to do this sort of thing (strafing). NEWXVALUE and NEWZVALUE . These are the trig equivalents of polar/matrix rotation calculations. Basically, they can help you find a position that you want to end up at. For strafing, that means to the left or the right of whatever direction you are facing. That means the Y angle -90 degrees and the y angle +90 degrees.

So if you wanted to strafe 5 units to the left:



and if you wanted to strafe 5 units right:



Enjoy your day.
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 14th Mar 2009 01:47
ok but thats a little too complex 4 me, i like my solution betr
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Mar 2009 01:58
Quote: "ok but thats a little too complex 4 me"


Really? The newxvalue, newzvalue, and newyvalue commands were put into DB to make trig stuff without the trig. You're using more code and wrapping the y value + and -90 degrees as well.

Quote: "i like my solution betr "

It's not a competition, it's just an alternative.

Enjoy your day.
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 14th Mar 2009 02:02
im not saying my code is betr than urs, im just sayin it makes more sense 2 me
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 14th Mar 2009 02:18
Ah, I see. Actually, there's about a thousand situations where I would use your method or one similar. That's one of the things I like about DB, if one digs around, there's always a solution, if not many!

Enjoy your day.
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 14th Mar 2009 13:55
the thing is I have already got this and I am not willing to rip out everything again as I couldn't seem to get things working on the same level and allow the player to get in and out of vehicles That1Smart Guy
Gosub
17
Years of Service
User Offline
Joined: 23rd Sep 2007
Location:
Posted: 14th Mar 2009 16:35
How do you get all the physics of the car to correspond realistically? Where do you get joy sticks?
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 14th Mar 2009 20:31 Edited at: 14th Mar 2009 20:52
Car? no Gosub, it a hovercraft, not a car and I did that with help from Vice and Kentee (joystick hat view) Jess Ticular (cammode view) and I got my joysticks of ebay uk and also if your asking about the instructions it is in DBC 1.13 upwards
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 17th Mar 2009 07:38
Hi BN2 Productions did you manage to make it work I am still having problem getting it to straffe in the 1t person, I was thinking of ripping the whole code out and using functions
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 30th Mar 2009 21:50
Go Sub are you good at go sub commands then because I am tearing my hair out here trying to get the player to straffe left and right using the WASD and arrow keys with the go sub command
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 30th Mar 2009 22:01
Sounds like you may be over complicating gosubs. Think of subroutines as sections of code that you will be using a lot. Rather than copying and pasting the code multiple times, then changing all of them when you have to fix something, you can use a single subroutine and use a gosub to go to it and execute the code.

Here is an example:

No Subroutine:


With Subroutine:


See? It isn't all that different, it just keeps the code a little more modular and (more importantly) keeps your main loop from getting cluttered.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 30th Mar 2009 22:08
Oh OK because all I want is the camera to follow the player when in 3rd person mode to where the player goes and in 1st person mode to straffe, turn , go forwards and backwards e.t.c I will try this BN2 Productions
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 31st Mar 2009 01:20
Your best bet would probably be the SET CAMERA TO FOLLOW command. Can't explain it because I barely understand it, but TDK wrote a really good tutorial a while back.

What you could do is for first person you put a follow distance of 0 and for third you put a follow distance of say, 5.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 31st Mar 2009 02:15
or if 4 watevr reason that doesnt work for ya, just fill in some trig like in the clock program to find wat point is x amount behind the player and position the camera there, id elaborate but i have to work
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 31st Mar 2009 08:12
BN2 Productions sorry but I really hate that "Set to Follow " command for 3rd person I would much rather use the "Set camera to object orientation " its much better, much tighter, makes the camera do one thing and one thing only , follow the player, Set to follow floats all over the place, the only good thing for it is to have it in a separate view so you can look at your player avatat, car, ship hovercraft, hovercraft tank , hovertank, bike aircraft e.t.c e.t.c, apart from that its a pain in the ass
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 31st Mar 2009 08:58 Edited at: 31st Mar 2009 08:59
Set camera to follow is actually capable to be perfect for what you need (trust me, I have done it), it is just a delicate balance.

Check out TDK's tutorial on it

http://forum.thegamecreators.com/?m=forum_view&t=123485&b=10

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 31st Mar 2009 12:35
OK I will read TDK'S tutorial BN2 Productions
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 31st Mar 2009 17:27 Edited at: 1st Apr 2009 02:43
sesides, set camera to object orientation wouldnt do wat u need it to, that just rotates the camera to the same x,y,and z angles as the object, if you dont like the set to follow command one alternative is this:



this makes a hidden limb behind the character that will always be behind the character the same amount (specified by the offset command), then during the loop the camera is positioned at the limb and rotated towards the player (yes in this case set camera to object orientation works)
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 31st Mar 2009 18:20
hmmmmmmmmmmm thats a good ideaThat1Smart Guy might try that out
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 1st Apr 2009 02:44 Edited at: 1st Apr 2009 02:45
if u copyed my code b4 this time (read time above) ull need to re-copy it cuz i was looking back thru it and i noticed that my add limb command was missing a mesh value, its fixed now tho
vampyre
22
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 2nd Apr 2009 07:15
ok thanks That1Smart Guy

Login to post a reply

Server time is: 2025-08-08 20:42:27
Your offset time is: 2025-08-08 20:42:27