I'm not sure what you want but try putting this in the main loop.
if First_Stage = 1
if time >= 10
hide sprite 2
backdrop on
endif
endif
Like :
`turn on manual syncing to give you control
`of when to draw to the screen
sync on
`set the number of possible syncs per second to unlimited.
sync rate 0
hide mouse
`make the rnd() command more random by seeding it
`with the timer()
randomize timer()
`turn backdrop on so the objects don't leave trails behind them.
backdrop on
color backdrop 0
`disables the camera repositioning everytime a new object is created
`autocam on make the camera go to each object as it is created.
`autocam on is default
autocam off
`this command makes it draw the background
`behind the 3d stuff
draw sprites first
`disables the escape key exiting as you want the mouse to exit
disable escapekey
`load the background and make it a sprite
load image "backdrop.bmp",1,1
sprite 1,0,0,1
`turns backsave and transparency to the sprite off
`you don't need the backsave feature as the sprite never moves
`cellnum don't use transparency for back ground sprites
set sprite 1,0,0
hide sprite 1
`make the sprite the size of the screen
size sprite 1,screen width(), screen height()
`load the first cell
load object "cell.x",1
`position the cell at the center of the 3d world
`this is the default place to load so it isn't necessary
`just put it here to show the positioning ability
position object 1, 0, 0, 0
`position the camera at the same position as the cell
`but 10 units higher than it so you can look down at it.
position camera 0,10,0
`point camera at the center of the 3d world
point camera 0,0,0
`set the current number of cells
cellnum=1
`set a starting time value to be used for the timer
timebegin# = timer()
`set a flag to tell when growth starts
start_cell_growth = 0
`keep track of how far each cell moves
Cell_distance_moved# = 0
do
`add a basic time syncing so it runs close to the same speed on all computers
`set the time since last time check (check 2)
end_loop_time# = timer()
`set the amount of time between the 2 time checks
loop_time# = end_loop_time# - begin_loop_time#
`set the speed adjust value
`calculate this by the loop time / 1000 or loop time * .001
`this tells you the ratio of how fast it is going in relatin to 1000 miliseconds
speed_adjust# = (loop_time# *.001)
`set the first time check value (check 1)
begin_loop_time# = timer()
`if this is the first time the cells cycle through on the screen
`allow the user to show the cell backdrop with the spacekey
if First_Stage = 0
`if spacekey is pressed turn off backdrop and show background
if spacekey()=1
`allows the sprite to take the built in backdrops place
`and be seen
backdrop off
show sprite 1
`if spacekey is not pressed turn on backdrop and hide background
else
`allow the backdrop to take back control of the background when
`the sprite is hidden or it will leave trails behind the objects moving
backdrop on
hide sprite 1
endif
endif
`if the cell moves one unit or the cells haven't started growing yet
`clone cells
If Cell_distance_moved# >= 1 or start_cell_growth = 0
`set a flag to tell it that cell growth has started
start_cell_growth = 1
`update the current cell number
cellnum=cellnum+1
`clone a new cell and set it to the current clone number
clone object cellnum,1
`position the new cell at the last cells position
position object cellnum,object position x(cellnum-1),object position y(cellnum-1),object position z(cellnum-1)
`point the cell in a random direction for random growth
yrotate object cellnum,rnd(360)
`reset the cell movement distance for new cell
Cell_distance_moved# = 0
endif
`if cell growth has started begin to move cells
if start_cell_growth = 1
`set the distance for the cell to move per second
`* by speed_adjust# to tell it how far to move each frame
Cell_distance_to_move# = 5 * speed_adjust#
`move the cell the distance to move
move object cellnum,Cell_distance_to_move#
`update how far it has moved
Cell_distance_moved# = Cell_distance_moved# + Cell_distance_to_move#
endif
`*****************************************************
`* cellnum modified this to not retrun and re calculate *
`* a new direction if if goes out of the screen area *
`*****************************************************
if object screen x(cellnum) > screen width()-50 or object screen x(cellnum) < 50 then move object cellnum, -Cell_distance_to_move# : yrotate object cellnum,rnd(360)
if object screen y(cellnum) < 50 or object screen y(cellnum) > screen height()-50 then move object cellnum, -Cell_distance_to_move# : yrotate object cellnum,rnd(360)
`update the time value for the timer
time = (timer() - timebegin#)/1000
set cursor 5, screen height()-60
`print the time to the screen at the cursor location above
print time
`update the screen
`Added to make background disappear
if First_Stage = 1
if time >= 10
hide sprite 2
backdrop on
endif
endif
sync
`if time is 100 secs or above start cycle over with a background pic
if time >= 10
`load the new background
gosub LOAD_NEW_IMAGE
`remove old background of cell only the first time this is ran
`no need to keep re-deleting it when its gone
if First_Stage = 0
if image exist(1) = 1 then delete image 1
if sprite exist(1) = 1 then delete sprite 1
endif
`remove all clone cells
for i = 2 to cellnum
delete object i
next i
`reset all variables required to start over
cellnum=1
timebegin# = timer()
clone_delay# = timer()
start_cell_growth = 0
Cell_distance_moved# = 0
`set flag for first cell cycle to 1 so it knows it has already
`cycled on the screen once
First_Stage = 1
endif
`update the mousemovex and mousemovey values so they don't build up
`before you program starts
end_check_value_x = mousemovex()
end_check_value_y = mousemovey()
`if program has started for 1 or more seconds
`or one pass has completed allow exit by mouse
if time >= 1 or First_Stage = 1
if end_check_value_x > 0 or end_check_value_y > 0
exit
endif
endif
loop
`show cell back drop at the end
`if present remove backdrop sprites and delete cells
if image exist(2) = 1 then delete image 2
if sprite exist(2) = 1 then delete sprite 2
for i = 1 to cellnum
delete object i
next i
`load the background and make it a sprite
load image "backdrop.bmp",1,1
sprite 1,0,0,1
`turns backsave and transparency to the sprite off
`you don't need the backsave feature as the sprite never moves
`cellnum don't use transparency for back ground sprites
set sprite 1,0,0
show sprite 1
`make the sprite the size of the screen
size sprite 1,screen width(), screen height()
backdrop off
`you have to put 2 syncs here as DBP is double buffered
`and it will not show just 1 sync. you only need one in
`your loop because it calls the command each loop and they add together
sync
sync
wait 2000 : end
LOAD_NEW_IMAGE:
` This picks a number in the rand 0-3, then adds 1 to make it 1 to 4.
background_num = rnd(3) + 1
select background_num
case 1
load image "human.png", 2
endcase
case 2
load image "frog.png", 2
endcase
case 3
load image "squirrel.png", 2
endcase
case 4
load image "snake.png", 2
endcase
endselect
sprite 2, 0, 0, 2
size sprite 2, screen width(), screen height()
backdrop off
return