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....
`setup
sync on
sync rate 0
hide mouse
`dims
dim active(100,2)
maxwait=150
`make gun
make object cylinder 111,1
scale object 111,100,200,100
color object 111,rgb(0,0,255)
xrotate object 111,90
fix object pivot 111
`make bullets
for b=1 to 100
make object sphere b,1
color object b,rgb(255,0,0)
hide object b
next b
`main loop
do
`backdrop
color backdrop 0
`controls
if rightkey()=1 then yrotate object 111,wrapvalue(object angle y(111)+1)
if leftkey()=1 then yrotate object 111,wrapvalue(object angle y(111)-1)
`pos cam
position camera 0,15,-15
point camera 0,0,0
gosub shoot
`end
sync
loop
shoot:
`for
for b=1 to 100
`shoot
if spacekey()=1 and active(b,1)=0 and (timer()-lasttime)>maxwait
position object b,0,0,0
set object to object orientation b,111
active(b,1)=1
active(b,2)=200
show object b
lasttime=timer()
endif
`move bullet
if active(b,1)=1
move object b,.1
active(b,2)=active(b,2)-1
endif
`stop when bullet run out
if active(b,2)<0
active(b,1)=0
active(b,2)=0
hide object b
endif
next b
return
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.