I had a look at tidying up the player control into a single set of code (previously it was split depending on the player):
The only thing missing is where we check the firing the 'force' parameter is no longer used, but it doesn't appear to cause any changes to the control of the player.
Centralised the player collision (walls and doors) into a single area:
Update Players.bb - Player_UpdateAll - replace 'Don't hit walls' and remove 'door objects 7 and 8, opendoor function needs to be replaced with animation stuff'
Got to go to Cricket Training, but want to try and get the player/alien collision done when I get home. If anyone else want to do that, feel free!
If control(pright,pl\id) And pl\x<7552 Then mr=True If control(pleft,pl\id) And pl\x>0 Then ml=True If control(pup,pl\id) And pl\y>0 Then mu=True If control(pdown,pl\id) And pl\y<7552 Then md=True If control(pfire1,pl\id) fireWeapon(pl,pl\dir*45) firing = True EndIf
The only thing missing is where we check the firing the 'force' parameter is no longer used, but it doesn't appear to cause any changes to the control of the player.
Centralised the player collision (walls and doors) into a single area:
Update Players.bb - Player_UpdateAll - replace 'Don't hit walls' and remove 'door objects 7 and 8, opendoor function needs to be replaced with animation stuff'
; Object Collision (walls, doors etc) If mr Then If gettile(pl\x+playerradius,pl\y,0)=0 Then If control(pstrafe,Player_Count+1)=0 Then pl\x=pl\x+1 move=True ElseIf gettile(pl\x+playerradius,pl\y,2)=7 Then If keycheck(pl\id) Then opendoor((pl\x+playerradius)/32,pl\y/32) End If direct=direct+"R" End If If ml Then If gettile(pl\x-playerradius,pl\y,0)=0 Then If control(pstrafe,Player_Count+1)=0 Then pl\x=pl\x-1 move=True ElseIf gettile(pl\x-playerradius,pl\y,2)=7 Then If keycheck(pl\id) Then opendoor((pl\x-playerradius)/32,pl\y/32) End If direct=direct+"L" End If If mu Then If gettile(pl\x,pl\y-playerradius,0)=0 Then If control(pstrafe,Player_Count+1)=0 Then pl\y=pl\y-1 move=True ElseIf gettile(pl\x,pl\y-playerradius,2)=8 Then If keycheck(pl\id) Then opendoor(pl\x/32,(pl\y-playerradius)/32) End If direct=direct+"U" End If If md Then If gettile(pl\x,pl\y+playerradius,0)=0 Then If control(pstrafe,Player_Count+1)=0 Then pl\y=pl\y+1 move=True ElseIf gettile(pl\x,pl\y+playerradius,2)=8 Then If keycheck(pl\id) Then opendoor(pl\x/32,(pl\y+playerradius)/32) End If direct=direct+"D" End If
Got to go to Cricket Training, but want to try and get the player/alien collision done when I get home. If anyone else want to do that, feel free!