Hi /b/
Ups...sorry
Hey there.I had pretty much trouble with .x collision, but after all that threads I finally managed to make it work.The problem is this.It seems to work only on Y axis.The gravity is working.But I still walk trough walls.
source
sync on
sync rate 0
hide mouse
make object sphere 1,50
`SC_SetupObject 1,0,1
set object collision to spheres 1
`Loading map
load object "scara.x",3
position object 1,-400,2069,200
position object 3,0,0,0
`sc_setupObject 3,0,0
set object collision to polygons 3
do
gosub _hud
gosub _gravity
gosub _control
sync
loop
_hud:
print "Object positions"
print "X";camera position x(0)
print "Y";camera position y(0)
print "Z";camera position z(0)
print "Collision";Object collision(1,3)
return
_control:
camy#=camy#+mousemovex()*.1
camx#=camx#+mousemovey()*.1
if camx#>90 and camx#<135 then camx#=90
if camx#>270 and camx#<225 then camx#=90
yrotate camera camy#
xrotate camera camx#
yrotate object 1,camy#
if keystate(17)=1 then upF()
if keystate(31)=1 then downF()
if keystate(30)=1 then leftF()
if keystate(32)=1 then rightF()
if mouseclick()=1 then susF()
if mouseclick()=2 then josF()
if spacekey()=1 then sari()
position camera 0,object position x(1),object position y(1), object position z(1)
return
_gravity:
gravity#=2.5
xold#=object position x(1)
yold#=object position y(1)
zold#=object position z(1)
if object Collision(1,3)=1 then position object 1, xold#,yold#,zold#
if object Collision(1,3)=0 then position object 1, object position x(1),object position y(1)-gravity#, object position z(1)
return
function upF()
text 0,0,"UP"
move object 1,2
endfunction
function downF()
text 0,0,"DOWN"
move object 1,-2
endfunction
function leftF()
text 0,0,"LEFT"
move object left 1,2
endfunction
function rightF()
text 0,0,"RIGHT"
move object right 1,2
endfunction
function susF()
position object 1, object position x(1),object position y(1)+1, object position z(1)
endfunction
function josF()
position object 1, object position x(1),object position y(1)-1, object position z(1)
endfunction
function sari()
`for i=0 to 5 step 1
position object 1,object position x(1), object position y(1)+1, object position z(1)
`next
`for i=5 to i=0 step -1
` position object 1,object position x(1),object position y(1)-i, object position z(1)
`next
endfunction