Hi. I am new to the forums. I tried a search for this problem but didn't come up with an answer. I am writing a program that uses sprites. I then want to capture the screen before moving the sprites and then capturing the next frame. I cant seem to do this, all I get is a blank image. Here is the code. Help!
Rem ***** Included Source File *****
rem Created: Sunday, July 28, 2013
Rem ***** Main Source File *****
rem test for command line string
set window layout 1,0,0
set window size 640,480
set window position (desktop width()-640)/2,(desktop height()-480)/2
set window title cl$()
sync on
rem create data types
maxactors=1000
type actor
id as integer rem this is the actors id num (ie sprite number)
image_file as string rem this is the path to the actors image
image_num as integer rem this is the image number for the actor
endtype
dim actors(maxactors) as actor
type control
actor_file as string rem this is the name of the file that contains the commands
output_dir as string rem this is the directory that any images will be put out to
output_status as integer rem if this is 0, no images will be output, if this is 1 then images will be output
start_frame as integer rem the starting frame to render
end_frame as integer rem the ending frame to render
output_frame_num as integer rem the starting frame number to use for output (ie you may start at frame 1 but output as frame 100)
play_delay as integer rem this is the delay to use when in play mode (not used in step mode)
current_frame as integer rem the current frame being processed
endtype
control_data as control
rem load the player controls
INK RGB(255,255,0),RGB(0,0,255)
box 0,0,640,480
load image "exit.bmp",10000,1
sprite 10000,230,440,10000
load image "restart.bmp",10001,1
sprite 10001,270,440,10001
load image "play.bmp",10002,1
sprite 10002,320,440,10002
load image "pause.bmp",10003,1
sprite 10003,360,440,10003
load image "step.bmp",10004,1
sprite 10004,410,440,10004
rem load the projects setting file
setfile$=cl$()+".set"
if setfile$+".set" then setfile$="test.set"
if file exist(setfile$)=1
open to read 1,setfile$
control_data.actor_file=cl$()+".act"
read string 1,control_data.output_dir
read string 1,t$:control_data.output_frame_num=val(t$)
read string 1,t$:control_data.start_frame=val(t$)
read string 1,t$:control_data.end_frame=val(t$)
read string 1,t$:control_data.play_delay=val(t$)
read string 1, t$:control_data.output_status=val(t$)
close file 1
endif
if control_data.actor_file=".act" then control_data.actor_file="test.act"
break
rem start of interpeter
open to read 1,control_data.actor_file
while file end(1)=0
read string 1, l$
rem get the command
cmd$=first token$(l$,",")
select cmd$
case "startframe"
control_data.current_frame=control_data.current_frame+1
endcase
case "create_actor"
actornum=val(next token$(","))
actorpath$=next token$(",")
actorx=val(next token$(","))
actory=val(next token$(","))
load image actorpath$,actornum,1,1
sprite actornum,actorx,actory,actornum
paste sprite actornum,sprite x(actornum),sprite y(actornum)
actors(actornum).id=actornum
actors(actornum).image_file=actorpath$
actors(actornum).image_num=actornum
actors(actornum).image_num=actornum
endcase
case "endframe"
rem set window title str$(control_data.output_status)
if control_data.output_status=1
sync
get image 10010,0,0,639,479,3
img$=control_data.output_dir+"frame"+str$(control_data.output_frame_num)+".bmp"
save image img$,10010,0
delete image 10010
control_data.output_frame_num=control_data.output_frame_num+1
endif
endcase
endselect
endwhile
close file 1
wait key
for t=10000 to 10004
delete image t
next t
for t=1 to maxactors
if actors(t).image_num>0 then delete image actors(t).image_num
next
end