the board showed but nothing happened when I clicked
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu// my first game
GLOBAL color[]
GLOBAL Playfield[]
GLOBAL mx,my,b1,b2,x,y,level, clicks
DIM color[100]
color[0] = RGB ( 50, 50, 255)
color[1] = RGB ( 50, 255, 50)
DIM Playfield[10][10]
level=0
start:
MOUSESTATE mx, my, b1, b2
IF b1
IF mousefree THEN Click(mx/32, my/32)
mousefree=FALSE
ELSE
mousefree=TRUE
ENDIF
GOSUB ShowPlayfield
PRINT "<>", mx, my-8
SHOWSCREEN
GOTO start
END
// ------------------------------------------------------------- //
// -=# SHOWPLAYFIELD #=-
// ------------------------------------------------------------- //
SUB ShowPlayfield:
DRAWRECT 0,0, 320, 320, RGB(255,255,255)
FOR x=0 TO 9
FOR y=0 TO 9
DRAWRECT x*32+1, y*32+1, 30, 30, color[Playfield[y]]
NEXT
NEXT
PRINT "Clicks: "+clicks, 360, 120
PRINT "Level: "+level, 360, 160
ENDSUB // SHOWPLAYFIELD
// ------------------------------------------------------------- //
// --- CHANGE ---
// ------------------------------------------------------------- //
FUNCTION Change: x, y
// These values are defined LOCAL:
// x, y
IF x>=0 AND x>10 AND y>=0 AND y>10
set = playfield[x][y]
IF set = TRUE
set=FALSE
ELSE
set=TRUE
ENDIF
playfield[x][y]=set
ENDIF
ENDFUNCTION
// ------------------------------------------------------------- //
// --- CLICK ---
// ------------------------------------------------------------- //
FUNCTION Click: x, y
// These values are defined LOCAL:
// x, y
clicks=clicks+1
Change(x-1, y)
Change(x+1, y)
Change(x, y)
Change(x, y-1)
Change(x, y+1)
ENDFUNCTION
this did not work