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 / Now to shoot from the line

Author
Message
Mucky Muck Ninja
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: im not entirely sure
Posted: 10th Jan 2004 18:01
Bye the way, thanks a lot for the code easily confused, it worked perfectly!
Sorry for posting again so soon. Now i need a small circle to fire from the turret. I have the shooting code but i can only shoot upwards. Does anyone know how to make the bullet(a circle) move according to the line?

Am I an Idiot...or is everyone else just really smart?
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 10th Jan 2004 18:40 Edited at: 10th Jan 2004 18:41
Find the position in 3D space that you are aiming at, and move your bullet object from its current position, to there Or you could just position the object at the gun turrent, get the appropriate firing angle and simply

BulZ=Object Position Z(Bullet)

inc bulz,1

Position object bullet,bulx,buly,bulz

RPGamer


We need help! Email us! [email protected]
Mucky Muck Ninja
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: im not entirely sure
Posted: 10th Jan 2004 18:45
Im sorry, i didn't specify. This is a 2d game that Im making without any media(so im using circles and lines and squares). There isn't a rotate circle command or a point circle command and I do not know how to move the circle at the same angle as the turret(a line sticking out of a circle)

Am I an Idiot...or is everyone else just really smart?
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2004 19:06
Find the angle that the circle would have to be rotated at to move in that direction. Then use the following commands:
x = newxvalue(x, angle, speed)
y = newzvalue(y, angle, speed)

or if you don't wanna use built in commands:

x = x + cos(angle)*speed
y = y + sin(angle)*speed

Assuming my math is accurate, both should produce the same results.

"eureka" - Archimedes
Mucky Muck Ninja
21
Years of Service
User Offline
Joined: 4th Sep 2003
Location: im not entirely sure
Posted: 10th Jan 2004 19:37
Thanks! The idea of using NewXValue never occured to me because it is in Basic3d, not 2d. It works perfectly now!

Am I an Idiot...or is everyone else just really smart?
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 10th Jan 2004 20:16
Quote: "Bye the way, thanks a lot for the code easily confused, it worked perfectly!"


You're welcome

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.

Login to post a reply

Server time is: 2025-05-22 09:02:13
Your offset time is: 2025-05-22 09:02:13