I'm sorry about this but... I'm having trouble getting the movement. The code's
really messyUsing the method above to create the players, here's movement/weapon switching code:
For p.pl=Each pl
;gravity
TranslateEntity p\cam,0,grav#,0
If p\cont$="Mouse"
;If p\num=1
mouserotatex#=MouseXSpeed()
mouserotate#=mouserotate#+mouserotatex#
RotateEntity p\cam,0,mouserotate#,0
If MouseDown(1)
MoveEntity p\cam,0,0,move#
Else If MouseDown( 2 ) And MouseDown(1)
MoveEntity p\cam,0,0,-move#
EndIf
If MouseHit(2)
PlaySound shoot
b.bullet=New bullet
If p\powbul=0
b\sprite=CopyEntity(spark)
Else
b\sprite=CopyEntity(spark2)
EndIf
RotateEntity b\sprite,0,EntityYaw(p\cam),0
PositionEntity b\sprite,EntityX(p\cam),EntityY(p\cam)+.4,EntityZ(p\cam)
b\angle=0
b\from=1
EntityType b\sprite,TYPE_BULLET
EndIf
If MouseZ()>0 Then attack1=attack1+1
If MouseZ()<0 Then attack1=attack1-1
attack1=MouseZ()
Select attack1
Case 0
at1$="mine"
Case 1
at1$="detonater"
Case 2
at1$="flag"
End Select
If MouseHit(3)
Select at1$ ;find weapon
Case "mine"
m.mine=New mine
m\model=CopyEntity(min)
PositionEntity m\model,EntityX(p\cam),EntityY(p\cam)-1.4,EntityZ(p\cam)
m\time=0
m\from=1
m\kind=0
Case "detonater"
If mineplaced1=0
mineplaced1=1
m.mine=New mine
m\model=CopyEntity(min2)
PositionEntity m\model,EntityX(p\cam),EntityY(p\cam),EntityZ(p\cam)
m\time=0
m\from=1
m\kind=1
EndIf
Case "flag"
If polep1=0
pole1=LoadMesh("polered.b3d")
PositionEntity pole1,EntityX(p\cam),EntityY(p\cam),EntityZ(p\cam)
EntityColor pole1,255,0,0
ScaleMesh pole1,.1,.1,.1
RotateMesh pole1,0,90,0
polep1=1
EndIf
End Select
EndIf
If MouseDown(1) And MouseDown(2) And MouseDown(3) Then ;zoom
If zoom#<3
zoom#=zoom#+0.2
EndIf
Else
If zoom#>0
zoom#=zoom#-0.2
EndIf
EndIf
If zoom#<1 Then zoom#=1
CameraZoom p\cam,zoom#
EndIf
;EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If p\cont$="Keys"
;If p\num=2
If KeyDown( 205 )
TurnEntity p\cam,0,-2,0
EndIf
If KeyDown( 203 )
TurnEntity p\cam,0,2,0
EndIf
If KeyDown( 208 )
MoveEntity p\cam,0,0,-move#
Else If KeyDown( 200 )
MoveEntity p\cam,0,0,move#
EndIf
If KeyHit(157)
b.bullet=New bullet
If p\powbul=0
b\sprite=CopyEntity(spark)
Else
b\sprite=CopyEntity(spark2)
EndIf
RotateEntity b\sprite,0,EntityYaw(p\cam),0
PositionEntity b\sprite,EntityX(p\cam),EntityY(p\cam)+.4,EntityZ(p\cam)
b\angle=0
b\from=2
EntityType b\sprite,TYPE_BULLET
EndIf
If KeyHit(29)
attack2=attack2+1
Select attack2
Case 0
at2$="mine"
Case 1
at2$="detonater"
Case 2
at2$="flag"
End Select
EndIf
If KeyHit(56)
attack2=attack2-1
Select attack2
Case 0
at2$="mine"
Case 1
at2$="detonater"
Case 2
at2$="flag"
End Select
EndIf
If KeyHit(57)
Select at2$
Case "mine"
m.mine=New mine
m\model=CopyEntity(min)
PositionEntity m\model,EntityX(p\cam),EntityY(p\cam)-1.4,EntityZ(p\cam)
m\time=0
m\from=2
Case "detonator"
If mineplaced2=0
mineplaced2=1
m.mine=New mine
m\model=CopyEntity(min2)
PositionEntity m\model,EntityX(p\cam),EntityY(p\cam),EntityZ(p\cam)
m\time=0
m\from=2
m\kind=1
EndIf
Case "flag"
If polep2=0
pole2=LoadMesh("poleblue.b3d")
PositionEntity pole2,EntityX(p\cam),EntityY(p\cam),EntityZ(p\cam)
EntityColor pole2,0,0,200
ScaleMesh pole2,.1,.1,.1
RotateMesh pole2,0,90,0
polep2=1
EndIf
End Select
EndIf
If KeyDown(58) ;zoom
If zoom2#<3
zoom2#=zoom2#+0.2
EndIf
Else
If zoom2#>0
zoom2#=zoom2#-0.2
EndIf
EndIf
If zoom2#<1 Then zoom2#=1
CameraZoom p\cam,zoom2#
EndIf
;JOYSTICK;;;;;;;;;;;;;;;;;;;;
If p\cont$="Joy"
If JoyXDir()=1 Then TurnEntity p\cam,0,2,0
If JoyXDir()=-1 Then TurnEntity p\cam,0,-2,0
If JoyDown(1)
MoveEntity p\cam,0,0,move#
Else If JoyDown( 2 ) And JoyDown(1)
MoveEntity p\cam,0,0,-move#
EndIf
If JoyHit(2)
PlaySound shoot
b.bullet=New bullet
If p\powbul=0
b\sprite=CopyEntity(spark)
Else
b\sprite=CopyEntity(spark2)
EndIf
RotateEntity b\sprite,0,EntityYaw(p\cam),0
PositionEntity b\sprite,EntityX(p\cam),EntityY(p\cam)+.4,EntityZ(p\cam)
b\angle=0
b\from=1
EntityType b\sprite,TYPE_BULLET
EndIf
If JoyU()<>0 Then attack1=attack1+1
If JoyV()<>0 Then attack1=attack1-1
attack1=MouseZ()
Select attack1
Case 0
at1$="mine"
Case 1
at1$="detonater"
Case 2
at1$="flag"
End Select
If JoyHit(3)
Select at1$ ;find weapon
Case "mine"
m.mine=New mine
m\model=CopyEntity(min)
PositionEntity m\model,EntityX(p\cam),EntityY(p\cam)-1.4,EntityZ(p\cam)
m\time=0
m\from=1
m\kind=0
Case "detonater"
If mineplaced1=0
mineplaced1=1
m.mine=New mine
m\model=CopyEntity(min2)
PositionEntity m\model,EntityX(p\cam),EntityY(p\cam),EntityZ(p\cam)
m\time=0
m\from=1
m\kind=1
EndIf
Case "flag"
If polep1=0
pole1=LoadMesh("polered.b3d")
PositionEntity pole1,EntityX(p\cam),EntityY(p\cam),EntityZ(p\cam)
EntityColor pole1,255,0,0
ScaleMesh pole1,.1,.1,.1
RotateMesh pole1,0,90,0
polep1=1
EndIf
End Select
EndIf
If JoyDown(1) And JoyDown(2) And JoyDown(3) Then ;zoom
If zoom#<3
zoom#=zoom#+0.2
EndIf
Else
If zoom#>0
zoom#=zoom#-0.2
EndIf
EndIf
If zoom#<1 Then zoom#=1
CameraZoom p\cam,zoom#
EndIf
Next
p\cont$ is the controller for your player (mouse,keys,joy)
Part of this is your switching weapons and detonating them.
Here's the code to choose your control type: (AlphaGUI)
If AlphaGetReleased$()="1"
start=1
players_to_find$=AlphaGetValue$("players")
If players_to_find$="0" Then players=2
If players_to_find$="1" Then players=3
If players_to_find$="2" Then players=4
p1cont_find$=AlphaGetValue$("P1cont")
If p1cont_find$="0" Then p1cont$="Mouse"
If p1cont_find$="1" Then p1cont$="Keys"
If p1cont_find$="2" Then p1cont$="Joy"
If p1cont_find$="3" Then p1cont$="XboxJoy"
p2cont_find$=AlphaGetValue$("P2cont")
If p2cont_find$="0" Then p2cont$="Mouse"
If p2cont_find$="1" Then p2cont$="Keys"
If p2cont_find$="2" Then p2cont$="Joy"
If p2cont_find$="3" Then p2cont$="XboxJoy"
p3cont_find$=AlphaGetValue$("P3cont")
If p3cont_find$="0" Then p3cont$="Mouse"
If p3cont_find$="1" Then p3cont$="Keys"
If p3cont_find$="2" Then p3cont$="Joy"
If p3cont_find$="3" Then p3cont$="XboxJoy"
p4cont_find$=AlphaGetValue$("P4cont")
If p4cont_find$="0" Then p4cont$="Mouse"
If p4cont_find$="1" Then p4cont$="Keys"
If p4cont_find$="2" Then p4cont$="Joy"
If p4cont_find$="3" Then p4cont$="XboxJoy"
Cls
Print "Players: "+players
Print "P1: "+p1cont$
Print "P2: "+p2cont$
Print "P3: "+p3cont$
Print "P4: "+p4cont$
EndIf
Sorry it's so messy. It's a project I've restarted after a year gap. Had to convert the whole thing to types.