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 / Help, positioning object!

Author
Message
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 10th Jun 2004 23:39
Hi

Its been a while sense I have posted on this forum, but it looks like I need some help. I have the following shooting code....



The problem is that I added a piece of code to move the gun object, but when I move it the bullets still shoot from the original starting position of the object, my question is....

How can I make it so that when I press the fire button it will position the bullets at the guns position then fire? O
Oh and by the way, I wanted to know if I could convert this to 2D and use sprites instead of objects, how would I do that? would it operate mostly the same?

Thanks

P4 3.2Ghz/Alienware area 51/radeon 9800 pro 256mb/sound blaster audigy 2/5.1 surround sound speakers.
Tyler
21
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 11th Jun 2004 01:30
I think you could put something like this in, when your bullets first created and then move it from there...


http://www.geocities.com/tylerc1324
Xander
22
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 12th Jun 2004 06:47 Edited at: 12th Jun 2004 06:56
That will position the bullet at the center of the gun. To get it to position it at the barrel you need to know the distance from the center that the end of the barrel is. Then use sin and cos to find the end of the gun using the angle that it is at.

Sprites are 2D, not 3D, so you need images of the character and guns, not objects. However, you can make a 2D game with 3D graphics by positioning the camera off to the side of the character and moving the character only forward, backward, up and down.

There is a really good thread by DARKGuy about positioning a bullet at the end of the barrel of a tank gun. That should help you out.
http://darkbasicpro.thegamecreators.com/?m=forum_view&t=32421&b=10

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href][/href]

Login to post a reply

Server time is: 2025-05-26 02:53:46
Your offset time is: 2025-05-26 02:53:46