Im having a problem when I try to run the code to make a bunch of objects after the program is already running. When I use the code on start-up it works fine but if I run it halfway through the program the blocks explode everywhere. Any ideas? I'd run it through the debugger, but I cant figure out how to get that to work.
phy start
sync on
sync rate 0
autocam off
color backdrop 0
make light 1
set directional light 1, -5, -5, 5
position camera -20, 20, -25
point camera 0, 10, 0
make object box 1, 1000, 1, 1000
color object 1,RGB(0,128,128)
phy make rigid body static box 1
makeboxes()
go=1
do
if scancode()=19 AND go=1
go=0
for boxdel=4 to 11
delete object boxdel
next boxdel
makeboxes()
endif
if scancode()=0 then go=1
phy update
sync
loop
function makeboxes()
height=0
for boxes=4 to 7
make object box boxes,6,1,2
position object boxes,0,height,0
phy make rigid body dynamic box boxes
phy set rigid body mass boxes,10
phy set rigid body linear velocity boxes,0,0.1,0
inc height,2
next boxes
for boxes=8 to 11
make object box boxes,6,1,2
position object boxes,0,height,2
phy make rigid body dynamic box boxes
phy set rigid body mass boxes,10
phy set rigid body linear velocity boxes,0,0.1,0
inc height,2
next boxes
endfunction
Press R to delete and remake the boxes and see what happens.
Your mod has been erased by a signature