Home > 2. Windows Programming, 4. Others, Managed Code, Technical stuffs, UI > What can you do with MS SmallBasic

What can you do with MS SmallBasic

I spent my rarely free time before the Lunar New Year holiday by playing with SmallBasic – one of more interesting tools introduced by Microsoft. Just another easy tool for newbies, and at the first sight, I was really skeptical. SmallBasic just has less than 15 keywords, and I can’t imagine anything I can do with it…

Then I thought about the flash games sometimes I play, I realized that they were surprising wonderful ideas. I start with Crash Down, a popular kind of small game, and I think (the most important thing) I can make it using SmallBasic within a few days.

After 2 days (3h/day), I realized some weakness of SmallBasic:

1. Subroutines are totally parameterless: well, 2 choices to overcome this are using global variable or Stack pushing/poping.

2. No bit manipulation: it’s easy to understand 🙂

3. Cannot write the long code line on two lines. Really bad!

4. blah blah…

And this is the code of Crash Down – SmallBasic version. This is just a developing version, and I will complete it in the Tet holidays  (if I can)

CrashDown - SmallBasic version by PHV

CrashDown - SmallBasic version by PHV

GraphicsWindow.MouseDown = MouseUpHandler

BWIDTH        = 25    ' box width in pixel
BOARD_XPOS    = 20    ' left of board, in pixel
BOARD_YPOS    = 20    ' top of board, in pixel
BOARD_WIDTH   = 15    ' width of board, in boxes
BOARD_HEIGHT  = 20    ' height of board, in boxes
SCORE_XPOS    = 420   ' left of Score board
SCORE_YPOS    = 100   ' top of Score board
LEVEL_YPOS    = 150   ' top of Level board

INDEX_BASE    = 100   ' base when creating array index for board data

ARR_BOARD     = "BoardData"   ' array name of data on the board
ARR_BOARDCOLOR = "BoardColor"  ' array name of the color of the boxes on board
ARR_NEXT      = "NextBoxes"   ' array name of next boxes
ARR_NEXTCOLOR = "NextColors"  ' array name of color of the next boxes
ARR_COLORS    = "ColorsData"  ' array name of template colors
STK_FINDCELL  = "StackFinding"  ' Stack name...
ARR_FOUNDCELL = "FoundCell"     ' array name of the array contains shapes that have same color (FindCell, FindTop...)
m_iLevel      = 1
m_iTop        = 0             ' x row of the highest box
m_iScore      = 0

'=============================================================================

GraphicsWindow.Width = 600
GraphicsWindow.Height = 600
GraphicsWindow.Title = "Crash Down!"

InitBoard()
InitData()
Program.Delay(1000)
'CreatePieces()
MainLoop()

'=============================================================================

'=============================================================================
Sub MainLoop

 While m_iTop < 20'BOARD_HEIGHT

 CreatePieces()
 AddNewRow()

 DrawMainBoard()
 Program.Delay(500)

 m_iTop = m_iTop + 1
 EndWhile
EndSub
'=============================================================================

'=============================================================================
Sub CreatePieces
 'TextWindow.WriteLine("CreatePeices")
 iMaxColor = Math.Min(6, 2 + Math.Ceiling(m_iLevel / 3))

 GraphicsWindow.PenColor = "White"
 GraphicsWindow.PenWidth = 1

 If Array.ContainsIndex(ARR_NEXT, -1) = "False" then
 Array.SetValue(ARR_NEXT, -1, 0)
 EndIf
 If Array.GetValue(ARR_NEXT, -1) >= BOARD_WIDTH Then
 Array.SetValue(ARR_NEXT, -1, 0)
 EndIf

 ii = Array.GetValue(ARR_NEXT, -1)
 While ii < BOARD_WIDTH
 iNewColor = Math.GetRandomNumber(iMaxColor)
 GraphicsWindow.BrushColor = Array.GetValue(ARR_COLORS, iNewColor)

 s = GraphicsWindow.AddRectangle(BWIDTH, BWIDTH)
 GraphicsWindow.MoveShape(s, BOARD_XPOS + ii * BWIDTH, BOARD_YPOS + (BOARD_HEIGHT + 1)* BWIDTH)

 Array.SetValue(ARR_NEXT, ii, s)
 Array.SetValue(ARR_NEXTCOLOR, ii, iNewColor)

 Array.SetValue(ARR_NEXT, -1, ii + 1)

 Program.Delay(200)
 ii = ii + 1
 EndWhile

EndSub
'=============================================================================

'=============================================================================

Sub AddNewRow
 'TextWindow.WriteLine("AddNewRow")

 ' not create enough boxes -> recreate!
 'TextWindow.WriteLine(Array.GetValue(ARR_NEXT, -1))

 If Array.GetValue(ARR_NEXT, -1) < BOARD_WIDTH Then
 'TextWindow.WriteLine("Recreate >:)")
 CreatePieces()
 EndIf

 For i = 0 to BOARD_WIDTH - 1

 ' Move all boxes up one row

 top = BOARD_HEIGHT - 1
 While Array.ContainsIndex(ARR_BOARD, i * INDEX_BASE + top) = "False" And top > 0
 top = top - 1
 EndWhile

 For j = top To 0 Step -1
 Array.SetValue(ARR_BOARD, i * INDEX_BASE + j + 1, Array.GetValue(ARR_BOARD, i * INDEX_BASE + j))
 Array.SetValue(ARR_BOARDCOLOR, i * INDEX_BASE + j + 1, Array.GetValue(ARR_BOARDCOLOR, i * INDEX_BASE + j))
 EndFor

 ' Add new row (candicate) to the bottom row
 Array.SetValue(ARR_BOARD, i * INDEX_BASE, Array.GetValue(ARR_NEXT, i))
 Array.SetValue(ARR_BOARDCOLOR, i * INDEX_BASE, Array.GetValue(ARR_NEXTCOLOR, i))
 EndFor

EndSub
'=============================================================================

'=============================================================================
Sub DrawMainBoard

 For i = 0 to BOARD_WIDTH - 1
 For j = 0 To BOARD_HEIGHT - 1
 If Array.ContainsIndex(ARR_BOARD, i * INDEX_BASE + j) = "True" Then
 'GraphicsWindow.MoveShape(Array.GetValue(ARR_BOARD, i * INDEX_BASE + j), BOARD_XPOS + i * BWIDTH, BOARD_YPOS + (BOARD_HEIGHT - j - 1)*BWIDTH)
 GraphicsWindow.AnimateShape(Array.GetValue(ARR_BOARD, i * INDEX_BASE + j), BOARD_XPOS + i * BWIDTH, BOARD_YPOS + (BOARD_HEIGHT - j - 1)*BWIDTH, 50)
 'GraphicsWindow.DrawText(BOARD_XPOS + i * BWIDTH + 3, BOARD_YPOS + (BOARD_HEIGHT - j - 1)*BWIDTH + 3, Array.GetValue(ARR_BOARDCOLOR, i * INDEX_BASE + j))
 Endif
 EndFor
 EndFor
EndSub
'=============================================================================

'=============================================================================
Sub ReArrangeMainBoard

 ' Mix upper to lower
 For i1 = 0 To BOARD_WIDTH - 1

 jEmptyBottom = 0
 jLocalMax = 0
 For j = 0 to BOARD_HEIGHT - 1
 If Array.ContainsIndex(ARR_BOARD, i1 * INDEX_BASE + j) = "True" Then

 If jEmptyBottom <> j Then
 Array.SetValue(ARR_BOARD, i1 * INDEX_BASE + jEmptyBottom, Array.GetValue(ARR_BOARD, i1 * INDEX_BASE + j))
 Array.SetValue(ARR_BOARDCOLOR, i1 * INDEX_BASE + jEmptyBottom, Array.GetValue(ARR_BOARDCOLOR, i1 * INDEX_BASE + j))
 Array.RemoveValue(ARR_BOARD, i1 * INDEX_BASE + j)
 Array.RemoveValue(ARR_BOARDCOLOR, i1 * INDEX_BASE + j)
 EndIf
 jEmptyBottom = jEmptyBottom + 1
 jLocalMax = j
 EndIf
 EndFor

 If m_iTop < jLocalMax Then
 'm_iTop = jLocalMax
 EndIf
 EndFor

 ' Mix from right to left
 iEmptyColumn = 0

 For i2 = 0 to BOARD_WIDTH - 1
 If Array.ContainsIndex(ARR_BOARD, i2 * INDEX_BASE) = "True" Then
 If iEmptyColumn <> i2 Then

 For j = 0 to BOARD_HEIGHT - 1
 Array.SetValue(ARR_BOARD, iEmptyColumn * INDEX_BASE + j, Array.GetValue(ARR_BOARD, i2 * INDEX_BASE + j))
 Array.SetValue(ARR_BOARDCOLOR, iEmptyColumn * INDEX_BASE + j, Array.GetValue(ARR_BOARDCOLOR, i2 * INDEX_BASE + j))
 Array.RemoveValue(ARR_BOARD, i2 * INDEX_BASE + j)
 Array.RemoveValue(ARR_BOARDCOLOR, i2 * INDEX_BASE + j)
 EndFor
 EndIf
 iEmptyColumn = iEmptyColumn + 1
 EndIf
 EndFor

EndSub
'=============================================================================

'=============================================================================
Sub MouseUpHandler
 'TextWindow.WriteLine("MouseUpHandler")

 cellX = Math.Floor((GraphicsWindow.MouseX - BOARD_XPOS) / BWIDTH)
 cellY = BOARD_HEIGHT - 1 - Math.Floor((GraphicsWindow.MouseY - BOARD_YPOS) / BWIDTH)

 ' current cell has a box?
 If Array.ContainsIndex(ARR_BOARD, cellX * INDEX_BASE + cellY) = "True" Then

 Stack.PushValue(STK_FINDCELL, cellX)
 Stack.PushValue(STK_FINDCELL, cellY)
 FindCell()

 iCellCount = Array.GetValue(ARR_FOUNDCELL, 0)

 If iCellCount >= 3 Then
 For i = 1 To iCellCount

 ' remove the "explored" box
 GraphicsWindow.MoveShape(Array.GetValue(ARR_BOARD, Array.GetValue(ARR_FOUNDCELL, i)), -BWIDTH, -BWIDTH)
 Array.RemoveValue(ARR_BOARD, Array.GetValue(ARR_FOUNDCELL, i))
 Array.RemoveValue(ARR_BOARDCOLOR, Array.GetValue(ARR_FOUNDCELL, i))
 EndFor

 ReArrangeMainBoard()
 DrawMainBoard()

 ' update Score
 m_iScore = m_iScore + iCellCount
 DrawScore()
 EndIf

 EndIf
EndSub
'=============================================================================

'=============================================================================

Sub GetShapeColor
 ' in:     cellX, cellY        (in stack)
 ' out:  cellX, cellY, Color, ShapeID  (in stack)

 gCellY = Stack.PopValue(STK_FINDCELL)
 gCellX = Stack.PopValue(STK_FINDCELL)

 Stack.PushValue(STK_FINDCELL, gCellX)
 Stack.PushValue(STK_FINDCELL, gCellY)

 'If (gCellX >= 0) And (gCellX < BOARD_WIDTH) And (gCellY >= 0) And (gCellY < BOARD_HEIGHT) And (Array.ContainsIndex(ARR_BOARD, gCellX * INDEX_BASE + gCellY) = "True") Then
 If (Array.ContainsIndex(ARR_BOARD, gCellX * INDEX_BASE + gCellY) = "True") Then
 GetShapeOK = "True"

 Stack.PushValue(STK_FINDCELL, Array.GetValue(ARR_BOARDCOLOR, gCellX * INDEX_BASE + gCellY))   ' color
 Stack.PushValue(STK_FINDCELL, gCellX * INDEX_BASE + gCellY) ' id
 Else
 GetShapeOK = "False"
 EndIf

EndSub

Sub FindCell
 Array.SetValue(ARR_FOUNDCELL, 0, 0)

 GetShapeColor()
 If GetShapeOK = "True" Then
 Stack.PopValue(STK_FINDCELL)    ' we dont need the id here
 FindCellDQ()
 EndIf
EndSub
'fPad = ""

Sub FindCellDQ

 'fPad = Text.Append(fPad, " ")

 fColor = Stack.PopValue(STK_FINDCELL)
 GetShapeColor()

 If GetShapeOK = "True" Then
 fID = Stack.PopValue(STK_FINDCELL)

 'TextWindow.Write(Text.Append(fPad, Text.Append("FindCellDQ: ", Text.Append(fCellX, Text.Append(" ", fCellY)))))

 If fColor = Stack.PopValue(STK_FINDCELL) Then
 'TextWindow.Write(Tex
 fCellY = Stack.PopValue(STK_FINDCELL)
 fCellX = Stack.PopValue(STK_FINDCELL)

 bHas = "False"

 For i3 = 1 to Array.GetValue(ARR_FOUNDCELL, 0)
 If Array.GetValue(ARR_FOUNDCELL, i3) = fID Then
 bHas = "True"
 Goto NextStep
 EndIf
 EndFor

 NextStep:
 If bHas = "False" Then

 'TextWindow.WriteLine("  -> True")
 Array.SetValue(ARR_FOUNDCELL, 0, 1 + Array.GetValue(ARR_FOUNDCELL, 0))
 Array.SetValue(ARR_FOUNDCELL, Array.GetValue(ARR_FOUNDCELL, 0), fID)

 ' top
 Stack.PushValue(STK_FINDCELL, fCellX)
 Stack.PushValue(STK_FINDCELL, fCellY + 1)
 Stack.PushValue(STK_FINDCELL, fColor)
 FindCellDQ()

 ' left
 Stack.PushValue(STK_FINDCELL, fCellX - 1)
 Stack.PushValue(STK_FINDCELL, fCellY)
 Stack.PushValue(STK_FINDCELL, fColor)
 FindCellDQ()

 ' bottom
 Stack.PushValue(STK_FINDCELL, fCellX)
 Stack.PushValue(STK_FINDCELL, fCellY - 1)
 Stack.PushValue(STK_FINDCELL, fColor)
 FindCellDQ()

 ' right
 Stack.PushValue(STK_FINDCELL, fCellX + 1)
 Stack.PushValue(STK_FINDCELL, fCellY)
 Stack.PushValue(STK_FINDCELL, fColor)
 FindCellDQ()
 EndIf
 TextWindow.WriteLine("")
 Else
 Stack.PopValue(STK_FINDCELL)
 Stack.PopValue(STK_FINDCELL)
 EndIf
 Else
 Stack.PopValue(STK_FINDCELL)
 Stack.PopValue(STK_FINDCELL)
 EndIf

 'fPad = Text.GetSubText(fPad, 0, Text.GetLength(fPad) - 1)

EndSub

Sub FindCell1

 GetShapeColor()

 If GetShapeOK = "True" Then

 Array.SetValue(ARR_FOUNDCELL, 0, 1)
 Array.SetValue(ARR_FOUNDCELL, 1, Stack.PopValue(STK_FINDCELL))

 fColor = Stack.PopValue(STK_FINDCELL)
 fCellY = Stack.PopValue(STK_FINDCELL)
 fCellX = Stack.PopValue(STK_FINDCELL)

 Stack.PushValue(STK_FINDCELL, fCellX - 1)
 Stack.PushValue(STK_FINDCELL, fCellY)
 FindLeft()

 Stack.PushValue(STK_FINDCELL, fCellX)
 Stack.PushValue(STK_FINDCELL, fCellY + 1)
 FindTop()

 Stack.PushValue(STK_FINDCELL, fCellX + 1)
 Stack.PushValue(STK_FINDCELL, fCellY)
 FindRight()

 Stack.PushValue(STK_FINDCELL, fCellX)
 Stack.PushValue(STK_FINDCELL, fCellY - 1)
 FindBottom()

 EndIf
EndSub

Sub FindTop
 GetShapeColor()

 If GetShapeOK = "True" Then

 ftShape = Stack.PopValue(STK_FINDCELL)
 ftColor = Stack.PopValue(STK_FINDCELL)
 ftCellY = Stack.PopValue(STK_FINDCELL)
 ftCellX = Stack.PopValue(STK_FINDCELL)

 If ftColor = fColor Then

 ' Add to ARR_FOUNDCELL
 ' Array.GetValue(ARR_FOUNDCELL, 0)  += 1
 Array.SetValue(ARR_FOUNDCELL, 0, 1 + Array.GetValue(ARR_FOUNDCELL, 0))
 Array.SetValue(ARR_FOUNDCELL, Array.GetValue(ARR_FOUNDCELL, 0), ftShape)

 Stack.PushValue(STK_FINDCELL, ftCellX - 1)
 Stack.PushValue(STK_FINDCELL, ftCellY)
 FindLeft()

 Stack.PushValue(STK_FINDCELL, ftCellX)
 Stack.PushValue(STK_FINDCELL, ftCellY + 1)
 FindTop()

 Stack.PushValue(STK_FINDCELL, ftCellX + 1)
 Stack.PushValue(STK_FINDCELL, ftCellY)
 FindRight()

 EndIf
 Else
 Stack.PopValue(STK_FINDCELL)
 Stack.PopValue(STK_FINDCELL)
 EndIf

EndSub

Sub FindLeft
 GetShapeColor()

 If GetShapeOK = "True" Then

 flShape = Stack.PopValue(STK_FINDCELL)

 flColor = Stack.PopValue(STK_FINDCELL)
 flCellY = Stack.PopValue(STK_FINDCELL)
 flCellX = Stack.PopValue(STK_FINDCELL)

 If flColor = fColor Then

 ' Add to ARR_FOUNDCELL
 ' Array.GetValue(ARR_FOUNDCELL, 0)  += 1
 Array.SetValue(ARR_FOUNDCELL, 0, 1 + Array.GetValue(ARR_FOUNDCELL, 0))
 Array.SetValue(ARR_FOUNDCELL, Array.GetValue(ARR_FOUNDCELL, 0), flShape)

 Stack.PushValue(STK_FINDCELL, flCellX)
 Stack.PushValue(STK_FINDCELL, flCellY + 1)
 FindTop()

 Stack.PushValue(STK_FINDCELL, flCellX - 1)
 Stack.PushValue(STK_FINDCELL, flCellY)
 FindLeft()

 Stack.PushValue(STK_FINDCELL, flCellX)
 Stack.PushValue(STK_FINDCELL, flCellY - 1)
 FindBottom()

 EndIf
 Else
 Stack.PopValue(STK_FINDCELL)
 Stack.PopValue(STK_FINDCELL)
 EndIf

EndSub

Sub FindBottom
 GetShapeColor()

 If GetShapeOK = "True" Then

 fbShape = Stack.PopValue(STK_FINDCELL)
 fbColor = Stack.PopValue(STK_FINDCELL)
 fbCellY = Stack.PopValue(STK_FINDCELL)
 fbCellX = Stack.PopValue(STK_FINDCELL)

 If fbColor = fColor Then

 ' Add to ARR_FOUNDCELL
 ' Array.GetValue(ARR_FOUNDCELL, 0)  += 1
 Array.SetValue(ARR_FOUNDCELL, 0, 1 + Array.GetValue(ARR_FOUNDCELL, 0))
 Array.SetValue(ARR_FOUNDCELL, Array.GetValue(ARR_FOUNDCELL, 0), fbShape)

 Stack.PushValue(STK_FINDCELL, fbCellX - 1)
 Stack.PushValue(STK_FINDCELL, fbCellY)
 FindLeft()

 Stack.PushValue(STK_FINDCELL, fbCellX)
 Stack.PushValue(STK_FINDCELL, fbCellY - 1)
 FindBottom()

 Stack.PushValue(STK_FINDCELL, fbCellX + 1)
 Stack.PushValue(STK_FINDCELL, fbCellY)
 FindRight()

 EndIf
 Else
 Stack.PopValue(STK_FINDCELL)
 Stack.PopValue(STK_FINDCELL)
 EndIf

EndSub

Sub FindRight
 GetShapeColor()

 If GetShapeOK = "True" Then

 frShape = Stack.PopValue(STK_FINDCELL)
 frColor = Stack.PopValue(STK_FINDCELL)
 frCellY = Stack.PopValue(STK_FINDCELL)
 frCellX = Stack.PopValue(STK_FINDCELL)

 If frColor = fColor Then

 ' Add to ARR_FOUNDCELL
 ' Array.GetValue(ARR_FOUNDCELL, 0)  += 1
 Array.SetValue(ARR_FOUNDCELL, 0, 1 + Array.GetValue(ARR_FOUNDCELL, 0))
 Array.SetValue(ARR_FOUNDCELL, Array.GetValue(ARR_FOUNDCELL, 0), frShape)

 Stack.PushValue(STK_FINDCELL, frCellX)
 Stack.PushValue(STK_FINDCELL, frCellY + 1)
 FindTop()

 Stack.PushValue(STK_FINDCELL, frCellX + 1)
 Stack.PushValue(STK_FINDCELL, frCellY)
 FindRight()

 Stack.PushValue(STK_FINDCELL, frCellX)
 Stack.PushValue(STK_FINDCELL, frCellY - 1)
 FindBottom()
 EndIf
 Else
 Stack.PopValue(STK_FINDCELL)
 Stack.PopValue(STK_FINDCELL)
 EndIf

EndSub
'=============================================================================

'=============================================================================
Sub InitBoard

 GraphicsWindow.Clear()
 GraphicsWindow.BackgroundColor = "DarkKhaki" 'GraphicsWindow.GetColorFromRGB(0, 100, 100)
 GraphicsWindow.PenColor = "LightGray"
 For i = 0 to 600 step 100
 GraphicsWindow.DrawLine(i, 0, 600, 600 - i)
 GraphicsWindow.DrawLine(0, i, 600 - i, 600)
 GraphicsWindow.DrawLine(0, i, i, 0)
 GraphicsWindow.DrawLine(i, 600, 600, i)
 'GraphicsWindow.DrawLine(i, 0, i, 600)
 'GraphicsWindow.DrawLine(0, i, 600, i)
 EndFor

 ' draw main board & candicate row & score board
 iBoardPad = 5
 GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(200, 200, 200)
 GraphicsWindow.FillRectangle(BOARD_XPOS - iBoardPad, BOARD_YPOS - iBoardPad, BOARD_WIDTH * BWIDTH + 2 * iBoardPad, BOARD_HEIGHT * BWIDTH + 2 * iBoardPad)
 GraphicsWindow.FillRectangle(BOARD_XPOS - iBoardPad, BOARD_YPOS + (BOARD_HEIGHT + 1)* BWIDTH - iBoardPad, BOARD_WIDTH * BWIDTH + 2 * iBoardPad, BWIDTH + 2 * iBoardPad)
 GraphicsWindow.FillRectangle(SCORE_XPOS - iBoardPad, SCORE_YPOS - iBoardPad, 150 + 2 * iBoardPad, 30 + 2 * iBoardPad)
 GraphicsWindow.FillRectangle(SCORE_XPOS - iBoardPad, LEVEL_YPOS - iBoardPad, 150 + 2 * iBoardPad, 30 + 2 * iBoardPad)

 GraphicsWindow.BrushColor = "Black"
 GraphicsWindow.FillRectangle(BOARD_XPOS, BOARD_YPOS, BOARD_WIDTH * BWIDTH, BOARD_HEIGHT * BWIDTH)
 GraphicsWindow.FillRectangle(BOARD_XPOS, BOARD_YPOS + (BOARD_HEIGHT + 1)* BWIDTH, BOARD_WIDTH * BWIDTH, BWIDTH)
 GraphicsWindow.FillRectangle(SCORE_XPOS, SCORE_YPOS, 150, 30)
 GraphicsWindow.FillRectangle(SCORE_XPOS, LEVEL_YPOS, 150, 30)

 GraphicsWindow.BrushColor = "White"
 GraphicsWindow.FontSize = 20
 GraphicsWindow.FontName = "Arial"
 GraphicsWindow.FontBold = "False"
 GraphicsWindow.DrawText(SCORE_XPOS, SCORE_YPOS + 5, "Score: 0")
 GraphicsWindow.DrawText(SCORE_XPOS, LEVEL_YPOS + 5, "Level: 01")

 GraphicsWindow.FontName = "Courier New"
 GraphicsWindow.FontBold = "True"
 GraphicsWindow.DrawText(SCORE_XPOS, LEVEL_YPOS + 100, "Crash Down")
 GraphicsWindow.DrawText(SCORE_XPOS, LEVEL_YPOS + 130, "PHV.")

EndSub
'=============================================================================

'=============================================================================
Sub DrawScore
 GraphicsWindow.BrushColor = "Black"
 GraphicsWindow.FillRectangle(SCORE_XPOS, SCORE_YPOS, 150, 30)
 GraphicsWindow.BrushColor = "White"
 GraphicsWindow.FontSize = 20
 GraphicsWindow.FontName = "Arial"
 GraphicsWindow.FontBold = "False"
 GraphicsWindow.DrawText(SCORE_XPOS, SCORE_YPOS + 5, Text.Append("Score: ", m_iScore))
EndSub
'=============================================================================

'=============================================================================
Sub InitData

 For i = 0 To BOARD_WIDTH - 1
 For j = 0 To BOARD_HEIGHT - 1
 Array.RemoveValue(ARR_BOARD, i * INDEX_BASE + j)
 Array.RemoveValue(ARR_BOARDCOLOR, i * INDEX_BASE + j)
 EndFor
 EndFor

 Array.SetValue(ARR_COLORS, 1, "Crimson")
 Array.SetValue(ARR_COLORS, 2, "Green")
 Array.SetValue(ARR_COLORS, 3, "MediumBlue")
 Array.SetValue(ARR_COLORS, 4, "Yellow")
 Array.SetValue(ARR_COLORS, 5, "Magenta")
 Array.SetValue(ARR_COLORS, 6, "LightCyan")
EndSub
'=============================================================================
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: