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 / Dark Basic Classic Strafing/Sidestepping

Author
Message
BLink
20
Years of Service
User Offline
Joined: 1st Jan 2004
Location: Laptop, wherever that is
Posted: 24th Nov 2005 23:29
Well, I've been working on a FPS(it's not my first game, so I do know some coding, don't worry...just not a lot), and I have two big obstacles, shooting multiple visible bullets at the same time(which I'm talking about in another topic) and Sidestepping, or strafing. I use DBC, so I can't use the simple "move left" command, so I don't know where to go from here. My coding right now looks like this...



I know, it's sloppy, and on top of that, it doesn't seem to work when my object is turned. I have it continually facing the way my camera(controlled by my mouse) is facing with this code...



And so it's supposed to face the way the camera does in terms of left and right, then based on that, move left and right if you press "A" and "D". It does move forward when I tell it to, but for some reason, it won't strafe properly, and it seems to move left and right based on the direction it pointed when the game started, not the current direction. Can anyone help, or should I post more of my code?

Pineapple juice, the best drink ever made.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Nov 2005 23:35
the move object command is your problem, if you used trig for movement, you could +/- 90 from the angle the movement reacts to, so it would think youve turned, when you actually haven't, so you would just go away to the side.

BLink
20
Years of Service
User Offline
Joined: 1st Jan 2004
Location: Laptop, wherever that is
Posted: 25th Nov 2005 00:36
I'm not too familiar with trig, could you give an example of how it would work in the code?

Pineapple juice, the best drink ever made.
UFO
18
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 25th Nov 2005 01:29 Edited at: 25th Nov 2005 01:30

Instead of doing this, you should use newxvalue() and newzvalue(). Do something like this:

Just do the same kind of thing with the other key.
BLink
20
Years of Service
User Offline
Joined: 1st Jan 2004
Location: Laptop, wherever that is
Posted: 25th Nov 2005 04:00
I tried using your code, and it actually made me move left and right across the entire course as a reference point, not according to the direction I was facing. What I'm aiming for is just like a FPS where you can strafe left and right from which way you're facing.

Pineapple juice, the best drink ever made.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Nov 2005 14:22
Strafe Left:

Turn left 90 degrees, move forwards, turn right 90 degrees.

Strafe Right:

Turn right 90 degrees, move forwards, turn left 90 degrees.

If you do this before the sync, it won't be seen on screen.

Alternatively, type 'Strafe' or 'Strafing' into the search box at the bottom of the screen and find loads of answers to the same question!

TDK_Man

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 25th Nov 2005 16:26
Blink,
I have posted a strafing code on Galekus.com

http://galekus.com/downloads.php?cat_id=7

Its the last code.

Use the insrtuctions to use it. Also, in the loop, after the code for strafing, put ' Speed = 0 ' .
Tell me if it doesn't work and show me the code you are using it in.
I also have posted Saving and Loading, which is also very useful.
BLink
20
Years of Service
User Offline
Joined: 1st Jan 2004
Location: Laptop, wherever that is
Posted: 26th Nov 2005 02:16
TDK, if you look at my code, that's exactly what I did, and it wouldn't work. As for searching, "shooting multiple visible bullets at the same time(which I'm talking about in another topic)" I did a forum search on that one, with no results to what I was looking for, and then forgot to do a search for this one >_<

Xenocythe, thank you so much! That's exactly what I was looking for, and it works perfectly. I'm guessing the cos actions are what Zotoaster was reffering to. My game now works, thanks to you(sans the whole shooting thing...).

Pineapple juice, the best drink ever made.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 26th Nov 2005 05:29


Kinda tired so I won't explain tonight but if you require assistance in understanding it I will help.



TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 26th Nov 2005 07:10
Fair enough.

What you did should have worked - providing you have a single Sync at the end of your main loop. You didn't have a Sync in the code that you posted - hence me mentioning it.

Having multiple Syncs is the only reason I can think of for it not working.

But no matter now - you got it sorted!

TDK_Man

Login to post a reply

Server time is: 2024-09-24 09:33:48
Your offset time is: 2024-09-24 09:33:48