Hi and thanks for the input peter.
i know about the jerky going up on stairs i have worked alot but not figured out to get it smoth iam using jopie dopies collision library that i have slightly modified.
if anyone that is better than me on smoth collision please help me out on this to get jopies collision smother?
i belive that the jerky ness is also because i locked the sync rate to 38.
more or less that iam still crappy on many things about coding iam still learning alot.
i started coding when they announced the alienware competition that made me lok at the dbp trial version and after that got i hooked and bought it.
remstart
sliding collision:
move on x
check collision
if hit.. restore x
move on z
check collision
if hit.. restore z
jump and gravity.. y
check collision
if hit.. restore y, jump = able
remend
`get the walk angle
objectang#=colang#
`height off walkable object
hgc=18
`walk speed
wspd=4.5
`gravity strength
grs=7.2
`gravity strength 2
grs2=5.0
`max jump height
mjh=50.0
`jump duration smaller value longer jump higher value shorter
jdur=8
`get the old positions
yz#=object position y(objectnr)
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
mocoll=0
`if 'w' is pressed
if keystate(17)=1
`get the old positions
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
`make new positions
newx#=newxvalue(x#,objectang#,wspd)
newz#=z#
newy#=y#
`position the object
position object objectnr,newx#,object position y(objectnr),newz#
`if hit.. restore..
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
`get the old positions
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
`make new positions
newx#=x#
newz#=newzvalue(z#,objectang#,wspd)
newy#=y#
`position the object
position object objectnr,newx#,object position y(objectnr),newz#
`if hit.. restore..
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
endif
`the same is it with all the other directions..
if keystate(31)=1
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
newx#=newxvalue(x#,objectang#+180,wspd)
newz#=z#
newy#=y#
position object objectnr,newx#,object position y(objectnr),newz#
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
newx#=x#
newz#=newzvalue(z#,objectang#+180,wspd)
newy#=y#
position object objectnr,newx#,object position y(objectnr),newz#
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
endif
if keystate(32)=1
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
newx#=newxvalue(x#,objectang#+90,wspd)
newz#=z#
newy#=y#
position object objectnr,newx#,object position y(objectnr),newz#
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
newx#=x#
newz#=newzvalue(z#,objectang#+90,wspd)
newy#=y#
position object objectnr,newx#,object position y(objectnr),newz#
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
endif
if keystate(30)=1
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
newx#=newxvalue(x#,objectang#+270,wspd)
newz#=z#
newy#=y#
position object objectnr,newx#,object position y(objectnr),newz#
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
newx#=x#
newz#=newzvalue(z#,objectang#+270,wspd)
newy#=y#
position object objectnr,newx#,object position y(objectnr),newz#
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,newx#,newy#+hgc,newz#
mocoll=1
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
`put the object back
position object objectnr,x#,y#,z#
mocoll=1
endif
endif
endif
`old pos
x#=object position x(objectnr)
y#=object position y(objectnr)
z#=object position z(objectnr)
`if you are not jumping
if jumping(objectnr) = 0
if mocoll=1 and spacekey()=0 then grs=grs-grs2
`gravity
start_y#(objectnr) = y# - grs
`if you want.. and may jump
if spacekey()=1 and jumpable(objectnr) = 1
play sound 20
`set the variables right
jumping(objectnr) = 1
jump_angle#(objectnr) = 0
start_y#(objectnr) = object position y(objectnr)
jumpable(objectnr) = 0
endif
endif
`if you are jumping
if jumping(objectnr) = 1
`increse jump angle
jump_angle#(objectnr) = jump_angle#(objectnr) + jdur
`if its 180, then stop jumping
if jump_angle#(objectnr) => 180 then jumping(objectnr)=0
endif
`position the object (jump height)
position object objectnr,x#,start_y#(objectnr) + sin(jump_angle#(objectnr))*mjh,z#
`if hit..
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
if jump_angle#(objectnr)>0 then play sound 21:land=1500
`restore variables
jumping(objectnr) = 0
jump_angle#(objectnr) = 0
if spacekey()=0 then jumpable(objectnr) = 1
`reposition the object
position object objectnr,x#,yz#,z#
endif
`fix weird collison bugg
if object collision(objectnr,coll)>0 and object collision(objectnr,coll)<415
position object objectnr,x#,y#+2,z#
if keystate(17)=1 then move object objectnr,-wspd
if keystate(31)=1 then move object objectnr,wspd
if keystate(30)=1 then move object right objectnr,wspd
if keystate(32)=1 then move object left objectnr,wspd
endif
endfunction
AMD ATHLON 1.8 XP WITH AN GEFORCE 4 TITANIUM 4600 (128 MB) AND 256 MB DDRAM (266).