hey, i think i am making pretty good progress on my game for working on it a lil bit everday, and after a bit of searching and trying stuff out, i just came to a few bit of questions, first off here is my code
sync on
sync rate 60
set display mode 1024,768,32
Autocam Off
hide mouse
World=1
Size=1000
Segments=10
make matrix World,Size,Size,Segments,Segments
randomize matrix World,20
update matrix World
hero=1
make object cube hero,4
position object Hero,rnd(20),1,rnd(20)
`SET UP VARIABLES FOR HERO SPEED
`speed for hero
speed#=0.0
`acceleration speed
acceleration#=.015
`max speed hero can move at
MaxSpeed=3.0
`min speedhero can move at
MinSpeed=-1.0
`slowly move charector speed down when not moving
Friction#=.02
`make powerups for hero
PUpMSpeed=500
PUpAcc=501
`create power up objects and color
make object cube PUpMSpeed,3
color object PUpMSpeed,RGB (200,0,0)
make object cube PUpAcc,3
color object PUpAcc,RGB(0,200,0)
`random position on matrix
position object PUpMSpeed,rnd(700),1,rnd(700)
position object PUpAcc,rnd(500),1,rnd(500)
`collision variables
set object collision on hero
set object collision on PUpMSpeed
set object collision on PUpAcc
set object collision to boxes hero
set object collision to boxes PUpMSpeed
set object collision to boxes PUpAcc
dim active(200,2)
maxwait=100
for b=1 to 100
make object sphere b+100,1
color object b+100,rgb(255,0,0)
hide object b+100
next b
ammo#=500
`MAIN LOOP
do
`Here are our variables for the Hero. These are just position values
x1#=object position x(Hero)
z1#=object position z(Hero)
y1#=get ground height(World,x1#,z1#)
ay1#=object angle y(Hero)
`=====POWER UP VARIABLES=====
`FOR MAX SPEED
PUpMSpeed_X#=object position x(PUpMSpeed)
PUpMSpeed_Z#=object position z(PUpMspeed)
PUpMspeed_Y#=get ground height(world,PUpmspeed_x#,pupmspeed_z#)
`For Acceleration
PUpAcc_X#=object position x(PUpAcc)
PUpAcc_Z#=object position z(PUpAcc)
PUpAcc_Y#=get ground height(World,PUpAcc_X#,pupacc_y#)
`using PowerUp variables position the powerups on the map (in good spots)
position object PUpMSpeed,PUpMSpeed_X#,PUpMSpeed_Z#,PUpMspeed_Y#
position object PUpAcc,PUpAcc_X#,PUpAcc_Z#,PUpAcc_Y#
`stay on matrix
if x1#>Size then x1#=x1#-1
if x1#<0 then x1#=0
if z1#>Size then z1#=z1#-1
if z1#<0 then z1#=0
`camera follow hero
set camera to follow x1#,y1#,z1#,ay1#,70,25,1,1
position object Hero,x1#,y1#,z1#
set camera to object orientation hero
`if up arrow hit then increase hero speed
if Keystate(17)=1 then INC speed#,acceleration#
`down arrow decrease hero speed
if Keystate(31)=1 then DEC speed#,acceleration#
`strafe left
if Keystate(30)=1 then move object left hero,2
`strafe right
if Keystate(32)=1 then move object right hero,2
`cap the speed off
if speed#>MaxSpeed then speed#=MaxSpeed
`cap the speed off
if speed#<MinSpeed then speed#=MinSpeed
`cap strafe speed off
if StrafeSpeed#>MaxStrafe then StrafeSpeed#=MaxStrafe
`when dec strafe cap it off
if strafespeed#<MinStrafe then StrafeSpeed#=MinStrafe
`move the hero
move object Hero,speed#
if Keystate(17)=0 and Keystate(31)=0
`if moving forward and not hitting up or down arrows, decrease speed
if speed#>=0.0
DEC speed#,Friction#
endif
`if moving backwards and not hitting up or down arrows, increase speed
if speed#<=0.0
INC speed#,Friction#
endif
endif
`COLLISION CODE WITH POWER UPS<<<
if object collision(hero,PUpMSpeed)=1
hide object PUpMSpeed
endif
if object collision (hero,PUpAcc)=1
hide object PUpAcc
endif
set cursor 900,600
print "Ammo: "; ammo#
set cursor 0,0
`display hero variables for viewing
print "X Position "; x1#
print "Z Position ";z1#
print "Y Position ";y1#
print "Speed ";speed#
`look with mouse
ax1#=object angle x(hero)
mx=mousemovex()
my=mousemovey()
if mx<0 then yrotate object hero,ay1#-2
if mx>0 then yrotate object hero,ay1#+2
if my<0 then xrotate object hero,ax1#-.5
if my>0 then xrotate object hero,ax1#+.5
`sets up a crosshair
line screen width()/2-20,screen height()/2,screen width()/2+20,screen height()/2
line screen width()/2,screen height()/2-10,screen width()/2,screen height()/2+10
ellipse screen width()/2,screen height()/2,20,10
gosub shoot
sync
loop
shoot:
for b=1 to 100
if mouseclick()=1 and ammo#>0 and active(b+100,1)=0 and (timer()-lasttime)>maxwait
position object b+100,x1#,y1#,z1#
set object to object orientation b+100,hero
active(b+100,1)=1
active(b+100,2)=1000
show object b+100
ammo#=ammo#-1
lasttime=timer()
endif
if active(b+100,1)=1
move object b+100,7
active(b+100,2)=active(b+100,2)-1
endif
if active(b+100,2)<0
active(b+100,1)=0
active(b+100,2)=0
hide object b+100
endif
next b
return
my main question is how come when i shoot the bullets, they dont go to the crossair, they always end up shooting right below it, also is there a way to make it so when i look up with the mouse, the camera swings down so then i dont loose site of the the oject its following. thanks so much if you can help