This bit is wrong, you aren't resetting plrSpeedR#
if plrSpeedF# > 2 then plrSpeedF# = 2
if plrSpeedF# < -2 then plrSpeedF# = -2
if plrSpeedR# > 2 then plrSpeed[b]F[/b]# = 2
if plrSpeedR# < -2 then plrSpeed[b]F[/b]# = -2
change it to this:
if plrSpeedF# > 2 then plrSpeedF# = 2
if plrSpeedF# < -2 then plrSpeedF# = -2
if plrSpeedR# > 2 then plrSpeed[b]R[/b]# = 2
if plrSpeedR# < -2 then plrSpeed[b]R[/b]# = -2
try adding in code again:
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
before this line:
position object 2, object position x(2), object position y(2)-1, object position z(2)
and take this line out:
playerYColl# = y# - sc_getStaticCollisionY()
Re-written:
rem collision for the person
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
rem move the player
if falling = 0
if keystate(17)=1 then inc plrSpeedF#, 0.1
if keystate(31)=1 then dec plrSpeedF#, 0.1
if keystate(17)=0 and keystate(31)=0
if plrSpeedF# > 0
dec plrSpeedF#, 0.1
if plrSpeedF# < 0 then plrSpeedF# = 0
endif
if PlrSpeedF# < 0
inc plrSpeedF#, 0.1
if plrSpeedF# > 0 then plrSpeedF# = 0
endif
endif
if keystate(32)=1 then inc plrSpeedR#, 0.1
if keystate(30)=1 then dec plrSpeedR#, 0.1
if keystate(32)=0 and keystate(30)=0
if plrSpeedR# > 0
dec plrSpeedR#, 0.1
if plrSpeedR# < 0 then plrSpeedR# = 0
endif
if PlrSpeedR# < 0
inc plrSpeedR#, 0.1
if plrSpeedR# > 0 then plrSpeedR# = 0
endif
endif
if plrSpeedF# > 2 then plrSpeedF# = 2
if plrSpeedF# < -2 then plrSpeedF# = -2
if plrSpeedR# > 2 then plrSpeedF# = 2
if plrSpeedR# < -2 then plrSpeedF# = -2
else
if plrSpeedF# > 0
dec plrSpeedF#, 0.1
if plrSpeedF# < 0 then plrSpeedF# = 0
endif
if PlrSpeedF# < 0
inc plrSpeedF#, 0.1
if plrSpeedF# > 0 then plrSpeedF# = 0
endif
if plrSpeedR# > 0
dec plrSpeedR#, 0.1
if plrSpeedR# < 0 then plrSpeedR# = 0
endif
if PlrSpeedR# < 0
inc plrSpeedR#, 0.1
if plrSpeedR# > 0 then plrSpeedR# = 0
endif
if plrSpeedF# > 5 then plrSpeedF# = 2
if plrSpeedF# < -5 then plrSpeedF# = -2
if plrSpeedR# > 5 then plrSpeedR# = 2
if plrSpeedR# < -5 then plrSpeedR# = -2
endif
move object right 2, plrSpeedR#
move object 2, plrSpeedF#
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
position object 2, object position x(2), object position y(2)-1, object position z(2)
x# = object position x(2)
y# = object position y(2)
z# = object position z(2)
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,y#,z#,30,0)
if collide>0
if sc_getCollisionNormalY() > 0.3
x# = sc_getCollisionSlideX()
y# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
`playerYColl# = y# - sc_getStaticCollisionY()
falling = 0
endif
else
falling = 1
endif
position object 2,x#,y#,z#
Hope that helps!