You're correct, that part is not too hard, it was the next part that I was thinking of. Detecting if a bunch of atoms have been joined completely with each other... which I'm lost with. bmp image - http://socoder.net/uploads/124/atoms.rar [code] Graphics 320,200,0,2 AppTitle "Atomino - Blitz" atom_sprites = LoadAnimImage("atoms.bmp",24,24,0,9) electron_sprites = CreateImage(24,24,128) For t# = 0 To 127 x = 10.5 + 10.5 * Sin(t# * 2.8125) y = 10.5 + 10.5 * Cos(t# * 2.8125) SetBuffer ImageBuffer(electron_sprites,127-t#) DrawBlock atom_sprites,x,y,8 Next SetBuffer BackBuffer() Dim atom(20,12) ; which atom is where (1-4) Dim peg(20,12) ; which sides are connected Global space = 24 Global PUP = 1, PLEFT = 2, PDOWN = 4, PRIGTH = 8 Global nextAtom = 1 While Not KeyHit(1) mx = MouseX() my = MouseY() Cls Color 192,192,192 Rect 63,15,194,170,0 DrawBlock atom_sprites,0,0,nextAtom-1 If mx>63 And mx<253 And my>15 And my<183 Then cx = (MX-64)/space cy = (MY-16)/space DrawBlock atom_sprites,64+Floor(cx)*space,16+Floor(cy)*space,nextAtom-1 ; draw current atom at mouse position (cursor) If MouseHit(1) And atom(cx,cy)=0 Then atom(cx,cy)=nextAtom ; or whatever atom number nextAtom = Rnd(1,4) If cy>0 And atom(cx,cy) > peg(cx,cy) Then ; check UP a$=Bin$(peg(cx ,cy-1)) total=0 For temp = 1 To Len(a$) If Mid$(a$,temp,1)=1 Then total = total+1 Next If total < atom(cx,cy-1) peg(cx,cy-1)=peg(cx,cy-1) Or PDOWN peg(cx,cy)=peg(cx,cy) Or PUP End If End If ; cy>0 If cx>0 And atom(cx,cy) > peg(cx,cy) Then ; check LEFT a$=Bin$(peg(cx-1 ,cy)) total=0 For temp = 1 To Len(a$) If Mid$(a$,temp,1)=1 Then total = total+1 Next If total < atom(cx-1,cy) peg(cx-1,cy)=peg(cx-1,cy) Or PRIGTH peg(cx,cy)=peg(cx,cy) Or PLEFT End If End If ; cx>0 If cy<6 And atom(cx,cy) > peg(cx,cy) Then ; check DOWN a$=Bin$(peg(cx ,cy+1)) total=0 For temp = 1 To Len(a$) If Mid$(a$,temp,1)=1 Then total = total+1 Next If total < atom(cx,cy+1) peg(cx,cy+1)=peg(cx,cy+1) Or PUP peg(cx,cy)=peg(cx,cy) Or PDOWN End If End If ; cy<6 If cx<7 And atom(cx,cy) > peg(cx,cy) Then ; check RIGHT a$=Bin$(peg(cx+1 ,cy)) total=0 For temp = 1 To Len(a$) If Mid$(a$,temp,1)=1 Then total = total+1 Next If total < atom(cx+1,cy) peg(cx+1,cy)=peg(cx+1,cy) Or PLEFT peg(cx,cy)=peg(cx,cy) Or PRIGTH End If End If ; cx>0 End If ; mousedown End If For y=0 To 6 For x = 0 To 7 If atom(x,y)>0 Then a$=Bin$(peg(x,y)) total=0 For temp = 1 To Len(a$) If Mid$(a$,temp,1)=1 Then total = total+1 Next If atom(x,y)-total > 0 Then For t = 1 To atom(x,y)-total DrawImage electron_sprites, 64+x*space,16+y*space, (electron_frame + 128/(atom(x,y)-total)*t)And 127 Next End If DrawImage atom_sprites, 64+x*space,16+y*space,atom(x,y)-1 If peg(x,y) And PUP Then DrawImage atom_sprites, 64+x*space,16+y*space,4 If peg(x,y) And PLEFT Then DrawImage atom_sprites, 64+x*space,16+y*space,5 If peg(x,y) And PDOWN Then DrawImage atom_sprites, 64+x*space,16+y*space,6 If peg(x,y) And PRIGTH Then DrawImage atom_sprites, 64+x*space,16+y*space,7 End If Next Next Flip electron_frame = electron_frame + 3 ; adjust for animation speed electron_frame = electron_frame And 127 Wend End[/code] This post is from -- http://socoder.net/index.php?topic=2120