include "sdl.inc"

SetDisplay 640,480,1 
SetCaption "SDL FUN"
SetColorKey 255,0,255

sys fun, clic, fon, x, y, n
fun = LoadTiles "bmp/fun.bmp",4,8
fon = LoadImage "bmp/afont.bmp",60

While Key(27)=0 
ClsColor 255,255,255
DrawText fon, 240,32,"CLICK" 
DrawText fon, 240,340,"FUN " + n
DrawTiles fun,256,176,x,y
iF MouseButton=1 and clic=0 
clic=1
x +=1
iF x=4 
   x=0
   y +=1
   iF y=8 
      y=0
      n=0
   End iF	 
End iF
n += 1        
End iF
Flip
SetFps 60
iF MouseButton=0 Then clic=0
Wend
Ends