Sub drawPlayer
If medead Then
player.setLinearVelocity2(0,0)
player.GravityScale = 0
Return
End If
If Not(gamepause = True And medead = False) Then
If frames Mod 5 = 0 Then playerindex = playerindex + 1
End If
Dim objcordinate As objcor
objcordinate = player.UserData
Dim vec2 As lgMathVector2
vec2 = PosCon.box2d2world(player.Position.x,player.Position.y,0,0)
If bottleON Then
Batch.DrawTex2(playerFlyTexture, vec2.x-(vpW*0.08), vec2.y-(vpW*0.08), vpW*0.16,vpW*0.16)
End If
'check if exit gate now
Dim gateobj As objcor = gate.UserData
If gateobj.exitnow Then
If player.getLinearVelocityFromWorldPoint(player.WorldCenter).x = 0 And player.getLinearVelocityFromWorldPoint(player.WorldCenter).y = 0 Then
If exitCD < 0 Then Return
Batch.SetColorRGBA(1,1,1,mapping(exitCD,120,0,1,0))
Batch.DrawTex2(playervictory,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Batch.SetColorRGBA(1,1,1,1)
Return
End If
End If
If ontrain Then
If Abs(player.getLinearVelocityFromWorldPoint(player.WorldCenter).x) - Abs(trainbody.getLinearVelocityFromWorldPoint(trainbody.WorldCenter).x) > 1 Then
If drawleft Then
Batch.DrawRegion2(player_framesflip(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(player_frames(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
Else
If drawleft Then
Batch.DrawRegion2(playeridle_framesflip(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(playeridle_frames(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
End If
Return
End If
If onlift Then
If objcordinate.horizontal = 0 Then
If player.getLinearVelocityFromWorldPoint(player.WorldCenter).x <> liftonBody.getLinearVelocityFromWorldPoint(liftonBody.WorldCenter).x Then
If drawleft Then
Batch.DrawRegion2(player_framesflip(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(player_frames(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
Else
If drawleft Then
Batch.DrawRegion2(playeridle_framesflip(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(playeridle_frames(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
End If
Else
If Abs(player.getLinearVelocityFromWorldPoint(player.WorldCenter).x) > 0.2 Then
If drawleft Then
Batch.DrawRegion2(player_framesflip(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(player_frames(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
Else
If drawleft Then
Batch.DrawRegion2(playeridle_framesflip(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(playeridle_frames(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
End If
End If
Return
End If
If Abs(player.getLinearVelocityFromWorldPoint(player.WorldCenter).y) < 0.2 And Abs(player.getLinearVelocityFromWorldPoint(player.WorldCenter).x) < 0.2 Then
'IDLE
If drawleft Then
Batch.DrawRegion2(playeridle_framesflip(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(playeridle_frames(0,playerindex Mod 5),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
Else
If player.getLinearVelocityFromWorldPoint(player.WorldCenter).y > 1 Then 'JUMP
If drawleft Then
Batch.DrawTex2(playerjumpflip,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawTex2(playerjump,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
else if player.getLinearVelocityFromWorldPoint(player.WorldCenter).y < -0.2 Then 'FALL
If drawleft Then
Batch.DrawTex2(playerfallflip,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawTex2(playerfall,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
Else 'RUN
If flynow Then
If drawleft Then
Batch.DrawTex2(playerjumpflip,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawTex2(playerjump,vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
Else
If drawleft Then
Batch.DrawRegion2(player_framesflip(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
Else
Batch.DrawRegion2(player_frames(0,playerindex Mod 8),vec2.x-objcordinate.width*1.1,vec2.y-objcordinate.height/1.85,objcordinate.width*2.1,objcordinate.height*1.8)
End If
End If
End If
End If
End Sub