Walking up stairs

Blitz3D Forums/Blitz3D Beginners Area/Walking up stairs

This is the function that checks the controls for your character (its a FPS). I've also included the function that checks the physics. You can walk up stairs normally when you are going sideways but not when you are going forward. Please tell me if you find anything in here that I could change to fix it.
;--------------------------------------------------------------

;CONTROLS

Function controls()

If rifleselected=1
DrawImage aimer,355,255
EndIf

If pistolselected=1
DrawImage aimer2,355,255
EndIf

If KeyDown( 54 ) =1
WalkSpeed# = .05
Else
WalkSpeed# = .5
EndIf

If KeyDown( 57 ) =1 And Jumped =0
Jumped =1
EndIf

If KeyHit(2)
Animate rifle,3,.2,1
HideEntity rifle
ShowEntity pistol
Animate pistol,3,-.2,1
pistolselected=1
rifleselected=0
weaponout=1
End If

If KeyHit(3)
Animate pistol,3,.2,1
HideEntity pistol
ShowEntity rifle
Animate rifle,3,-.2,1
pistolselected=0
rifleselected=1
weaponout=1
End If

; Keys for movement
If FlyMode=0
If KeyDown(17) =1 Then MoveEntity CamPivot, 0, 0, WalkSpeed# Animate rifle,3,.2,2 UpdateWorld()
If KeyDown(31) =1 Then MoveEntity CamPivot, 0, 0, 0-WalkSpeed#
PositionEntity Camera, EntityX#( CamPivot ), EntityY#( CamPivot )+8, EntityZ#( CamPivot )
EndIf

If KeyDown(30) =1 Then MoveEntity CamPivot, -1, 0, 0
If KeyDown(32) =1 Then MoveEntity CamPivot, 1, 0, 0

If EntityCollided(CamPivot,2)
Jumped=0
Gravity#=0
EndIf

TranslateEntity CamPivot, 0, Gravity#, 0

TurnEntity CamPivot, 0, 0 -MouseXSpeed(), 0

TurnEntity Camera, MouseYSpeed(), 0, 0

RotateEntity CamPivot, EntityPitch#( CamPivot ), EntityYaw#( CamPivot ), 0

MoveMouse GraphicsWidth()/2, GraphicsHeight()/2

RotateEntity Camera, EntityPitch#( Camera ), EntityYaw#( CamPivot ), 0

physics()

If KeyHit(20)
Lazer=1
EndIf

If KeyHit(20)And Lazer=1
Lazer=0
EndIf

If ammo=0 Or ammo<0 And KeyHit(19)And machineguncartriges>0
Animate rifle,3,-.2,3
ammo=100
machineguncartriges=machineguncartriges-1
EndIf

If MouseHit(1)And pistolselected=1 And pistolammo>0
createbullet(Camera)
EndIf

If MouseDown(1) And rifleselected=1 And ammo>0
If MilliSecs()>delaytime Then
delaytime=MilliSecs()+800
createbullet(Camera)
ammo=ammo-1
EndIf
EndIf

updatesparks(sparks)



Flip

UpdateWorld()

RenderWorld

HideEntity muzzle

HideEntity muzzleglow

HideEntity muzzleglow2

Return
End Function
;--------------------------------------------------------------
Function physics()
Collisions 1,2,2,2
UpdateWorld()
ClearCollisions
End Function
;--------------------------------------------------------------
;Load Player
Global CamPivot = CreatePivot( )
Global Camera = CreateCamera( )
CameraRange Camera,.2,1000
CameraFogMode Camera,1
CameraFogRange Camera,.2,999
CameraFogColor Camera,19,164,149
PositionEntity CamPivot,1010,50,1010
EntityType CamPivot, 1
EntityRadius CamPivot, 6
EntityType Camera, 1
EntityRadius Camera, 2