How do I create sprites so they appear randomly from the left and right ends of the screen(i'm making a frogger game)? This is pretty confusing since you have to assign a number for each one so if you could help me, that'd be great. Thx.
loadmedia()
setup()
play()
function loadmedia()
`Function: Loads media game
load image "media/frogger.bmp",1
load image "media/car.bmp",2
load image "media/truck.bmp",3
endfunction
function setup()
`Function: Sets up the game(sprite positions, background...)
`and game options(sync rate...)
GLOBAL frx
GLOBAL fry
GLOBAL vx
sync on
sync rate 150
vx=0
frx=320
fry=416
endfunction
function play()
mtimer=1
do
sync
sprite 1,frx,fry,1
if sprite collision(1,2)=1 then wait 100 : end
open to write 1,"frogger.inf"
for vyt=2 to 13
vy=vyt*32
write float vyt,vy
next vyt
open to read 1,"frogger.inf"
for vyt=2 to 13
read vyt,
next vyt
`mtimer calculates the time allowed before frogger can move again
if mtimer=15
mtimer=1
`The upkey()=0 and downkey()=0 stuff makes it so frogger cannot move
`diagonally
if leftkey()=1 and upkey()=0 and downkey()=0 then dec frx,32
if rightkey()=1 and upkey()=0 and downkey()=0 then inc frx,32
if upkey()=1 and leftkey()=0 and rightkey()=0 then dec fry,32
if downkey()=1 and leftkey()=0 and rightkey()=0 then inc fry,32
endif
inc mtimer
loop
endfunction
wait key