Fun!
If I click on the black area below the color buttons, I get a "Sprite does not exist" error. Easy enough to fix though.
Maybe you could add some code to make it so that when you hold the pointer (mouse, finger, whatever) down, all the lights that you swipe across would light up.
//light up////
Setvirtualresolution(1024,768)
SetWindowTitle( "light up" )
dim images[8]
dim sprites[900]
global x
global y
global i
global hitnum
global colour = 5 //change between 1 and 8 for colors , need to implement buttons for changing colors
i = 0
//////////load images//////////////////
images[1] = LoadImage("red.png")
images[2] = LoadImage("yellow.png")
images[3] = LoadImage("green.png")
images[4] = LoadImage("purple.png")
images[5] = LoadImage("white.png")
images[6] = LoadImage("oran.png")
images[7] = LoadImage("blue.png")
images[8] = LoadImage("black.png")
for y = 0 to 24
for x = 1 to 32
inc i
sprites[i] = CreateSprite(images[8])
SetSpritePosition(sprites[i],x * 32 , y * 32)
next x
next y
////////////create buttons //////////////
AddVirtualButton(1, 15, 20, 32)
setvirtualbuttoncolor(1,255,0,0)
AddVirtualButton(2, 15, 62, 32)
setvirtualbuttoncolor(2,255,255,0)
AddVirtualButton(3, 15,104, 32)
setvirtualbuttoncolor(3,0,255,0)
AddVirtualButton(4, 15,146, 32)
setvirtualbuttoncolor(4,252,0,255)
AddVirtualButton(5, 15, 188, 32)
setvirtualbuttoncolor(5,255,255,255)
AddVirtualButton(6, 15, 230, 32)
setvirtualbuttoncolor(6,255,100,0)
AddVirtualButton(7, 15,272, 32)
setvirtualbuttoncolor(7,0,0,255)
eraser = loadimage("eraser.png")
AddVirtualButton(8, 15,314, 32)
setvirtualbuttonimageup(8,eraser)
AddVirtualButton(9, 15, 356, 32)
SetVirtualButtonColor(9,64,64,64)
SetVirtualButtonText(9,"CLEAR")
for b = 1 to 9
setvirtualbuttonalpha(b,255)
next b
do
colourcheck()
updatepointer()
Sync()
loop
function updatepointer()
if GetPointerState() = 1
hitnum = GetSpriteHit(GetPointerX(),GetPointerY())
if hitnum > 0
SetSpriteImage(hitnum, images[colour]);
endif
endif
endfunction
function colourcheck()
for c = 1 to 8
if GetVirtualButtonPressed(c) = 1 then colour = c
next c
if GetVirtualButtonPressed(9)
for b = 1 to i
SetSpriteImage(sprites[b], images[8])
next b
endif
endfunction
EDIT: I simplified your code a bit, and added the swiping thing I mentioned, and a "CLEAR" button to erase! Hope you don't mind