oic...
may i ask more few question???
the syntax for "Get Image" is
"Get Image
image number,left,top,right,bottom"
how i can specific or count the
left,top,right,bottom???
thank you very much...
P/S:hope u guys understand wat i talking about....
sorry guys.... my english very poor..
[edit] sorry.. i know the concept of
get imagealready
but may i ask another question???
dim ballx(41)
dim bally(41)
dim ballsize(41)
dim speedx(41)
dim speedy(41)
dim color(41)
`initialize the program
set display mode 640,480,16
sync on
sync rate 60
hide mouse
load image "spaceship.bmp",1
repeat
text 248,20, "SPACESHIP RUNNING"
ink rgb(rnd(255),rnd(255),rnd(255)),0
text 200,120, "Control:"
text 200,140, "Move Up = Arrow Up Key"
text 200,160, "Move Down = Arrow Down Key"
text 200,180, "Move Left = Arrow Left Key"
text 200,200, "Move Right = Arrow Right Key"
text 150,450, "HOLD the SPACEBAR button to start the game..."
until spacekey()=1
initializeballs()
`main loop
x=320
y=240
repeat
cls
rem-----problem-----
StartTime=timer()
text 100,100 ,"second"
rem------------------
ink rgb(255,255,255),0
`draw screen
drawrect(0,0,639,479)
`move and draw ball
for n=2 to 41
moveball(n)
next n
rem Control position with cursors
if upkey()=1 then y=y-3
if downkey()=1 then y=y+3
if leftkey()=1 then x=x-3
if rightkey()=1 then x=x+3
rem draw the sprite at the new position
sprite 1,x,y,1
if sprite hit(1,0)>0
rem------problem-----
StopTime=(timer()-StartTime)
rem-------------------
exit
endif
sync
until escapekey()=1
rem------problem-----
ink rgb(rnd(255),rnd(255),rnd(255)),0
text 320,240, "GAME OVER!"
text 100,300 "You had running"+ StopTime +"second"
text 150,360, "Thank you for playing..."
text 150,380, "Press any key to End the game..."
sync
wait key
rem----------------
end
function initializeballs()
for n=1 to 41
ballx(n)=rnd(640)
bally(n)=rnd(480)
ballsize=rnd(20)+5
speedx(n)=rnd(12)-3
speedy(n)=rnd(12)-3
color(n)=rgb(rnd(256),rnd(256),rnd(256))
next n
endfunction
function moveball(num)
`move the ball
ballx(num)=ballx(num)+speedx(num)
bally(num)=bally(num)+speedy(num)
`check condition ballx
if ballx(num)>640-ballsize(num)
ballx(num)=640-ballsize(num)
speedx(num)=-10
else
if ballx(num)<ballsize(num)
ballx(num)=ballsize(num)
speedx(num)=+10
endif
endif
`check condition bally
if bally(num)>480-ballsize(num)
bally(num)=480-ballsize(num)
speedy(num)=-10
else
if bally(num)<ballsize(num)
bally(num)=ballsize(num)
speedy(num)=+10
endif
endif
`draw the ball
ink color(num),0
circle ballx(num),bally(num),2
get image num,0,0,1,1
sprite num,ballx(num), bally(num),num
endfunction
function drawrect(left,top,right,bottom)
line left,top,right,top
line right,top,right,bottom
line right,bottom,left,bottom
line left,bottom,left,top
endfunction
may i know how can count the time when playing the game???
and the end display the time...
Thank you very much....
sorry my english very poor... hope u guys understand ...