This code places this code places the direct x object 60 near object 6 because it scales it at 60,60,60 which is too small
sync on : sync rate 60 : hide mouse : color backdrop rgb(100,100,255)
autocam off
rem create floor
make object box 1,400,10,400 : position object 1,0,-5,0
rem create walls
make object box 2,400,100,10 : position object 2,0,50,-200
make object box 3,400,100,10 : position object 3,0,50, 200
make object box 4,10,100,400 : position object 4,-200,50,0
make object box 5,10,100,400 : position object 5, 200,50,0
rem Set floor and walls to box collision for rectangle roamer
make object collision box 1,-200,-5,-200,200,5,200,0
make object collision box 2,-200,-50,-5,200,50,5,0
make object collision box 3,-200,-50,-5,200,50,5,0
make object collision box 4,-5,-50,-200,5,50,200,0
make object collision box 5,-5,-50,-200,5,50,200,0
rem create collision platform
make object box 6,10,12,10
position object 6,0,5,0
rem rectangle roamer for box collision
make object box 41,40,20,40 : position object 41,95,31,50
make object collision box 41,-20,-10,-20,20,10,20,0
set shadow shading on 41
rem create a crate for automatic collision
make object cube 61,15
automatic object collision 61,8.0,0
set object collision to spheres 61
position object 61,-75,30,75
set shadow shading on 61
rem setup camera and lights
set point light 0,0,0,0
make light 1 : set point light 1,0,0,0 : color light 1,255,-100,-100
position camera 0,30,-100
rem set automatic collision for camera
automatic camera collision 0,15,0
set global collision on
ObjectNumberF=16
MeshIndex1=2 : MeshIndex2=3 : MeshIndex3=4: MeshIndex4=5: MeshIndex5=6
make object sphere 16,20 : make mesh from object MeshIndex1, 16 : delete object 16
make object sphere 16,50 : make mesh from object MeshIndex3, 16 : delete object 16
make object sphere 16,50 : make mesh from object MeshIndex4, 16 : delete object 16
make object sphere 16,50 : make mesh from object MeshIndex5, 16 : delete object 16
make object sphere 16,50 : scale object 16,80,300,80
make mesh from object MeshIndex2, 16 : delete object 16
make object sphere ObjectNumberF, 100: scale object 16,70,50,70
add limb ObjectNumberF, 1, MeshIndex1 : link limb ObjectNumberF, 0, 1
add limb ObjectNumberF, 2, MeshIndex2 : link limb ObjectNumberF, 1, 2
add limb ObjectNumberF, 3, MeshIndex2 : link limb ObjectNumberF, 2, 3
add limb ObjectNumberF, 4, MeshIndex3 : link limb ObjectNumberF, 3, 4
add limb ObjectNumberF, 5, MeshIndex3 : link limb ObjectNumberF, 4, 5
add limb ObjectNumberF, 6, MeshIndex3 : link limb ObjectNumberF, 5, 6
offset limb ObjectNumberF, 3, 0, 60, 0
offset limb ObjectNumberF, 4, 0, 60, 0
offset limb ObjectNumberF, 5, 20, -40, 0
offset limb ObjectNumberF, 6, -40, -10, 0
scale limb ObjectNumberF, 5, 100, 10, 10
scale limb ObjectNumberF, 6, 110, 70, 70
hide limb ObjectNumberF, 0
position object ObjectNumberF,-100,10,0
load object "pebble.x",60
scale object 60,60,60,60
rem loop
do
a#=wrapvalue(a#+10)
for t=0 to 0
if limb exist(ObjectNumberF,t)=1 then rotate limb ObjectNumberF,t,0,0,cos(a#)*-10
next t
rem move crate to test automatic object collision
yrotate object 61,wrapvalue(object angle y(61)-0.2)
move object down 61,0.5
move object 61,0.5
if object in screen(41)=1 then center text object screen x(41),object screen y(41)-25,"Sliding Box Collision"
if object in screen(61)=1 then center text object screen x(61),object screen y(61)-25,"Automated Collision"
rem Add gravity to camera to test automatic collision
position camera camera position x(),camera position y()-1.01,camera position z()
rem rectangle roamer
move object 41,0.3
ballhit=object collision(41,0)
if ballhit>0
spin#=rnd(45)
ax#=object position x(41)-get object collision x()
ay#=object position y(41)-get object collision y()
az#=object position z(41)-get object collision z()
position object 41,ax#,ay#,az#
endif
if spin#>0
spin#=spin#-1.0
yrotate object 41,wrapvalue(object angle y(41)+1)
endif
rem move default light with ball
position light 0,object position x(1),object position y(1),object position z(1)
rem move coloured light with roamer
position light 1,object position x(41),object position y(41)+25,object position z(41)
position object 60,object position x(6),object position y(6)+25,object position z(6)
gosub _camera
rem update screen
sync
rem end loop
loop
_camera:
rem Read W,A,S,D keys for movement
tkeystate17=keystate(17)
tkeystate31=keystate(31)
tkeystate30=keystate(30)
tkeystate32=keystate(32)
rem Store CURRENT camera position
cox#=camera position x()
coy#=camera position y()
coz#=camera position z()
rem Determine camera direction
movement=0
if tkeystate17=1 then movement = 1
if tkeystate31=1 then movement = -1
if movement <> 0 then move camera 3.0 * movement
if tkeystate30 = 1 : // A key
y# = camera angle y()
// turn camera left 90 degrees
yrotate camera wrapvalue(y# + 270.0)
move camera 1.5
// turn camera back to normal
yrotate camera y#
endif
if tkeystate32 = 1 : // D key
y# = camera angle y()
// turn camera right 90 degrees
yrotate camera wrapvalue(y# + 90.0)
move camera 1.5
// turn camera back to normal
yrotate camera y#
endif
position mouse 400,300
cammovex#=mousemovex()*2
cammovey#=mousemovey()*2
camangx#=camera angle x()+cammovey#
camangy#=camera angle y()+cammovex#
if wrapvalue(camangx#)>85 and wrapvalue(camangx#)<180 then camangx#=85.0
if wrapvalue(camangx#)>180 and wrapvalue(camangx#)<275 then camangx#=275.0
rotate camera curveangle(camangx#,camera angle x(),15.0),curveangle(camangy#,camera angle y(),15.0),camera angle z()
return
This codes places the direct x object away from object 6 because it scales it at 6000,6000,6000?
sync on : sync rate 60 : hide mouse : color backdrop rgb(100,100,255)
autocam off
rem create floor
make object box 1,400,10,400 : position object 1,0,-5,0
rem create walls
make object box 2,400,100,10 : position object 2,0,50,-200
make object box 3,400,100,10 : position object 3,0,50, 200
make object box 4,10,100,400 : position object 4,-200,50,0
make object box 5,10,100,400 : position object 5, 200,50,0
rem Set floor and walls to box collision for rectangle roamer
make object collision box 1,-200,-5,-200,200,5,200,0
make object collision box 2,-200,-50,-5,200,50,5,0
make object collision box 3,-200,-50,-5,200,50,5,0
make object collision box 4,-5,-50,-200,5,50,200,0
make object collision box 5,-5,-50,-200,5,50,200,0
rem create collision platform
make object box 6,10,12,10
position object 6,0,5,0
rem rectangle roamer for box collision
make object box 41,40,20,40 : position object 41,95,31,50
make object collision box 41,-20,-10,-20,20,10,20,0
set shadow shading on 41
rem create a crate for automatic collision
make object cube 61,15
automatic object collision 61,8.0,0
set object collision to spheres 61
position object 61,-75,30,75
set shadow shading on 61
rem setup camera and lights
set point light 0,0,0,0
make light 1 : set point light 1,0,0,0 : color light 1,255,-100,-100
position camera 0,30,-100
rem set automatic collision for camera
automatic camera collision 0,15,0
set global collision on
ObjectNumberF=16
MeshIndex1=2 : MeshIndex2=3 : MeshIndex3=4: MeshIndex4=5: MeshIndex5=6
make object sphere 16,20 : make mesh from object MeshIndex1, 16 : delete object 16
make object sphere 16,50 : make mesh from object MeshIndex3, 16 : delete object 16
make object sphere 16,50 : make mesh from object MeshIndex4, 16 : delete object 16
make object sphere 16,50 : make mesh from object MeshIndex5, 16 : delete object 16
make object sphere 16,50 : scale object 16,80,300,80
make mesh from object MeshIndex2, 16 : delete object 16
make object sphere ObjectNumberF, 100: scale object 16,70,50,70
add limb ObjectNumberF, 1, MeshIndex1 : link limb ObjectNumberF, 0, 1
add limb ObjectNumberF, 2, MeshIndex2 : link limb ObjectNumberF, 1, 2
add limb ObjectNumberF, 3, MeshIndex2 : link limb ObjectNumberF, 2, 3
add limb ObjectNumberF, 4, MeshIndex3 : link limb ObjectNumberF, 3, 4
add limb ObjectNumberF, 5, MeshIndex3 : link limb ObjectNumberF, 4, 5
add limb ObjectNumberF, 6, MeshIndex3 : link limb ObjectNumberF, 5, 6
offset limb ObjectNumberF, 3, 0, 60, 0
offset limb ObjectNumberF, 4, 0, 60, 0
offset limb ObjectNumberF, 5, 20, -40, 0
offset limb ObjectNumberF, 6, -40, -10, 0
scale limb ObjectNumberF, 5, 100, 10, 10
scale limb ObjectNumberF, 6, 110, 70, 70
hide limb ObjectNumberF, 0
position object ObjectNumberF,-100,10,0
load object "pebble.x",60
scale object 60,6000,6000,6000
rem loop
do
a#=wrapvalue(a#+10)
for t=0 to 0
if limb exist(ObjectNumberF,t)=1 then rotate limb ObjectNumberF,t,0,0,cos(a#)*-10
next t
rem move crate to test automatic object collision
yrotate object 61,wrapvalue(object angle y(61)-0.2)
move object down 61,0.5
move object 61,0.5
if object in screen(41)=1 then center text object screen x(41),object screen y(41)-25,"Sliding Box Collision"
if object in screen(61)=1 then center text object screen x(61),object screen y(61)-25,"Automated Collision"
rem Add gravity to camera to test automatic collision
position camera camera position x(),camera position y()-1.01,camera position z()
rem rectangle roamer
move object 41,0.3
ballhit=object collision(41,0)
if ballhit>0
spin#=rnd(45)
ax#=object position x(41)-get object collision x()
ay#=object position y(41)-get object collision y()
az#=object position z(41)-get object collision z()
position object 41,ax#,ay#,az#
endif
if spin#>0
spin#=spin#-1.0
yrotate object 41,wrapvalue(object angle y(41)+1)
endif
rem move default light with ball
position light 0,object position x(1),object position y(1),object position z(1)
rem move coloured light with roamer
position light 1,object position x(41),object position y(41)+25,object position z(41)
position object 60,object position x(6),object position y(6)+25,object position z(6)
gosub _camera
rem update screen
sync
rem end loop
loop
_camera:
rem Read W,A,S,D keys for movement
tkeystate17=keystate(17)
tkeystate31=keystate(31)
tkeystate30=keystate(30)
tkeystate32=keystate(32)
rem Store CURRENT camera position
cox#=camera position x()
coy#=camera position y()
coz#=camera position z()
rem Determine camera direction
movement=0
if tkeystate17=1 then movement = 1
if tkeystate31=1 then movement = -1
if movement <> 0 then move camera 3.0 * movement
if tkeystate30 = 1 : // A key
y# = camera angle y()
// turn camera left 90 degrees
yrotate camera wrapvalue(y# + 270.0)
move camera 1.5
// turn camera back to normal
yrotate camera y#
endif
if tkeystate32 = 1 : // D key
y# = camera angle y()
// turn camera right 90 degrees
yrotate camera wrapvalue(y# + 90.0)
move camera 1.5
// turn camera back to normal
yrotate camera y#
endif
position mouse 400,300
cammovex#=mousemovex()*2
cammovey#=mousemovey()*2
camangx#=camera angle x()+cammovey#
camangy#=camera angle y()+cammovex#
if wrapvalue(camangx#)>85 and wrapvalue(camangx#)<180 then camangx#=85.0
if wrapvalue(camangx#)>180 and wrapvalue(camangx#)<275 then camangx#=275.0
rotate camera curveangle(camangx#,camera angle x(),15.0),curveangle(camangy#,camera angle y(),15.0),camera angle z()
return