When you use nested if statements code is a whole lot easier to read.
Your code nested:
if lft1=1
if go1=1
if jmpmv1=0
if xpos#>(-edge)
position object p1,(xpos#-(spd1*speed#)),ypos#,zpos#
mv1=1 : jmpmv1=1
endif
endif
endif
endif
if rgt1=1
if go1=1
if jmpmv1=0
if xpos#<edge
position object p1,(xpos#+(spd1*speed#)),ypos#,zpos#
mv1=1 : jmpmv1=2
endif
endif
endif
endif
if lft1=1
if ani1=0
if go1=0
if dn1=0
if blkng1=0
if xpos#>(-edge)
position object p1,(xpos#-(spd1*speed#)),ypos#,zpos# : loop object p1,mv1sf,mv1ef
mv1=1 : jmpmv1=3
endif
endif
endif
endif
endif
endif
if rgt1=1
if ani1=0
if go1=0
if dn1=0
if blkng1=0
if xpos#<edge
position object p1,(xpos#+(spd1*speed#)),ypos#,zpos#
loop object p1,mv1sf,mv1ef
mv1=2 : jmpmv1=3
endif
endif
endif
endif
endif
endif
if go1=1
if jmpmv1=1
if xpos#>(-edge)
position object p1,(xpos#-(spd1*speed#)),ypos#,zpos#
endif
endif
endif
if go1=1
if jmpmv1=2
if xpos#<edge
position object p1,(xpos#+(spd1*speed#)),ypos#,zpos#
endif
endif
endif
if lft1+rgt1=0 then mv1=0
All those variables could be easily put into arrays instead. Arrays are automatically global (when defined outside functions). When a function is called it does it's thing and goes back. There is no way for a function to be called at the same time for both players. I wrote some code for a basic design for what you're looking for. I probably got some of the infomation wrong but you can easily change that.
Hope this helps.
dim Player#(1,7)
` Player 1
Player#(0,0)=100 ` Health
Player#(0,1)=1000 ` X Position
Player#(0,2)=500 ` Y Position
Player#(0,3)=0 ` Z Position
Player#(0,4)=20 ` Player Speed
Player#(0,5)=0 ` Movement 0=None 1=Left 2=Right
Player#(0,6)=0 ` Jump Level 0=None
Player#(0,7)=1 ` go1 (not sure what that means)
` Player 2
Player#(1,0)=100 ` Health
Player#(1,1)=1000 ` X Position
Player#(1,2)=500 ` Y Position
Player#(1,3)=0 ` Z Position
Player#(1,4)=20 ` Player Speed
Player#(1,5)=0 ` Movement 0=None 1=Left 2=Right
Player#(1,6)=0 ` Jump Level 0=None
Player#(1,7)=1 ` go1 (not sure what that means)
global spd1=10 ` Things that are not player related need to be global
` MovePlayer(PlayerNumber)
function MovePlayer(z)
if Player#(z,5)=1
if Player#(z,7)=1
if Player#(z,6)=0
if Player#(z,1)>(-edge)
position object z,(Player#(z,1)-(spd1*Player#(z,4))),Player#(z,2),Player#(z,3)
Player#(z,5)=1 : Player#(z,6)=1
endif
endif
endif
endif
endfunction