try this hope it help
set display mode 800,600,32
sync
sync rate 100
hide mouse
piano=9999
p=999
sp#=1
b=9555
shell=0
rem world
make object box piano,1000,5,1000
position object piano,0,-5,0
color object piano,rgb(0,20,20)
rem player
make object cube p,5
position object p,0,0,0
color object p,rgb(200,0,0)
rem weapon
MAKE MESH FROM OBJECT 1,P
ADD LIMB P,1,1
OFFSET LIMB P,1,5,0,0
SCALE LIMB P,1,5,5,5
DELETE MESH 1
rem bullet
make object sphere b,0.9
position object b,0,-100,0
color object b,rgb(255,0,255)
`----------------------setup timer for buttle delay--------------------
shottime=timer()
shotcount=0
buttle=0
`----------------------Goto make buttle--------------------
gosub make_buttle
do
x#=object position x(p)
y#=object position y(p)
z#=object position z(p)
ay#=object angle y(p)
xl=limb position x(p,1)
yl=limb position y(p,1)
zl=limb position z(p,1)
rem camera
set camera to follow x#,y#,z#,ay#,25,y#+10,10,0
rem control player
if upkey()=1
inc x#,sin(ay#)*sp#
inc z#,cos(ay#)*sp#
endif
if downkey()=1
inc x#,sin(wrapvalue(ay#-180))*sp#
inc z#,cos(wrapvalue(ay#-180))*sp#
endif
if leftkey()=1
if keystate(56)=1
inc x#,sin(wrapvalue(ay#-90))*sp#
inc z#,cos(wrapvalue(ay#-90))*sp#
else
dec ay#,2
endif
endif
if rightkey()=1
if keystate(56)=1
inc x#,sin(wrapvalue(ay#+90))*sp#
inc z#,cos(wrapvalue(ay#+90))*sp#
else
inc ay#,2
endif
endif
rem if press "z" fire the gun
`if keystate(29)=1
`if shell<99
`inc shell,1
` if spara=0
rem posiziona proiettile
` position object b,xl,yl,zl
` rotate object b,0,ay#,0
` endif
` inc spara,1
`else
` if spara=0 then hide object b
`endif
`if spara>15 then spara=0
` if spara>0
` show object b
` move object b,1
` inc spara,1
` endif
`else
` hide object b
`endif
position object P,x#,y#,z#
yrotate object P,ay#
`-------------------fire buttle-- using left mouse button or ctrl -----------------
if mouseclick()=1 and shot=1 or keystate(29)=1 and shot=1
inc buttle
if buttle >buttlenum then buttle=1
position object b+buttle,xl,yl,zl
rotate object b+buttle,0,ay#,0
show object b+buttle
movebuttle(buttle)=object position z(p)
endif
if buttle>0 then gosub shoot :rem chick for buttle before going to shot
`----------------------------buttle timer for each shot-------------
shotcount=(timer()-shottime)/shotdelet
if shotcount>=3
shotcount=0
shottime=timer()
shot=1
else shot=0
endif
loop
`----------------------------------------------------make buttle--------------
make_buttle:
shotdelet=25:rem wait for time before each shot
buttlenum=20:rem number of buttle
distant=200:rem how far the bullet will go before it die
buttlespeed=20:rem how fast the buttle go
dim movebuttle(buttlenum)
for buttle=1 to buttlenum
`make object box b+buttle,1,1,3
make object sphere b+buttle,0.9
color object b+buttle,rgb(255,0,255)
next buttle
return
``--------------------------------------------SHOT-----------------------------
shoot:
for pshot=1 to buttlenum
if object exist(b+pshot)
move object b+pshot,buttlespeed
if object position z(b+pshot)>movebuttle(pshot)+distant then position object b+pshot,-1000000000,-1000000,-100000000
rem get the distant of each bullet
endif
next pshot
return
You can do it if you try