wait. i have to separate the two codes? why?
but i kinda got it working...sometimes. it will sometimes work, and usually wont.
heres my code for now. its quite small for the time being, and pretty cluttered. but i will sort everything soon as i get it working as i want for the most part
Sync On : Sync Rate 30 : backdrop on : color backdrop rgb(0,120,255) : hide mouse
if fog available()=1 then Fog on : Fog Distance 2500 : Fog Color rgb(100,140,150)
` make matrix
Make matrix 1,10000,10000,20,20
` Make player 1
Make object sphere 10,25
p1x = 1000
p1y = 100
p1z = 100
position object 10,p1x,p1y,p1z
` Make player 2
Make object cube 2,25
p2x = 1100
p2y = 100
p2z = 100
position object 2,p2x,p2y,p2z
playerturn = 1
` Randomize the matrix
randomize matrix 1,125
`position camera
cy# = 100 : cx# = 1000 : cy# = 1000
`Camera view
Set Camera view 5,5,635,400
position mouse 315, 200
` Main loop
Do
position mouse 315, 200
`Camera Position and angle values
cax# = Camera Angle X()
cay# = Camera Angle Y()
caz# = Camera Angle Z()
cx# = Camera Position X()
cy# = Camera Position Y()
cz# = Camera Position Z()
` Control input for camera
`mouse look
if mousey() < 400
If MouseMoveY() <> 0 Then cax# = wrapvalue(cax# + mousemovey() * .25)
If MouseMoveX() <> 0 Then cay# = wrapvalue(cay# + mousemovex() * .25)
endif
`mouse wheel moves up and down
If MouseMoveZ() <> 0 Then cy# = cy# + (MouseMoveZ() / 50)
`arrow keys move camera left/right, up down
If LeftKey() = 1
cx# = NewXValue(cx#,WrapValue(cay#-90),5)
cz# = NewZValue(cz#,WrapValue(cay#-90),5)
EndIf
If RightKey() = 1
cx# = NewXValue(cx#,WrapValue(cay#+90),5)
cz# = NewZValue(cz#,WrapValue(cay#+90),5)
EndIf
If UpKey() = 1
cx# = NewXValue(cx#,cay#,5)
cz# = NewZValue(cz#,cay#,5)
EndIf
If DownKey() = 1
cx# = NewXValue(cx#,cay#,-5)
cz# = NewZValue(cz#,cay#,-5)
EndIf
rotate camera cax#,cay#,caz#
Position Camera cx#,cy#,cz#
`restrict the mouse from going off screen if not paused
if pause = 0
If mousey() > 400 then position mouse mousex(), 400
endif
`points camera at player 1
if playerturn = 1
if spacekey() = 1
point camera p1x,p1y,p1z
position camera (p1x),(p1y+50),(p1z-100)
endif
endif
`points camera at player 2
if playerturn = 2
if spacekey() = 1
point camera p2x,p2y,p2z
position camera (p2x),(p2y+50),(p2z-100)
endif
endif
`shoot
if mouseclick() = 1
if playerturn = 1 then playerturn = playerturn + 1
else
playerturn = 1
endif
Sync
Loop
also, i figured out what i did wrong in that second code i posted earlier
i changed
if mouseclick() = 1
if playerturn = 1 then playerturn = playerturn + 1
else
playerturn = 1
endif
to
if returnkey() = 1
if playerturn = 2
playerturn = 1
else
playerturn = 2
endif
endif
Two words, moo.