I converted a couple of Peter Wirbelauer's OxygenBasic games to ScriptBasic. If you haven't done so already, download the ScriptBasic 2.2 beta release for Windows and unzip it in the directory of choice. Set your system search path to the ScriptBasic
bin directory. That will allow you to run ScriptBasic from anywhere and allow it to find it's configuration file that points to it's
include and
modules directories.
I have attached everything that is needed for each game. Make sure you copy the
dllc.dll from the modules directory in the zip to the ScriptBasic modules directory. Feedback welcome.
SM.sbx' ScriptBasic SokoMouse
INCLUDE "sbsw.inc"
SUB Initialize
SW_DrawBmp p1, 0, 0, 640, 480, 0
' SW_BmpText fo, 200, 8, "SokoMouse", 24, 24
zA = 0
Notified = FALSE
CALL ShowLevel
FOR bc = 0 TO 299
xBox[bc] = 0
yBox[bc] = 0
rBox[bc] = 0
zBox[bc] = 0
iBox[bc] = 0
NEXT
zR = 0
vR = 0
pHead = 3
Ready = 0
sl = 0
cV = 0
cR = 0
Steps = 0
RasReg = 0
KeyR = 0
KeyL = 0
KeyU = 0
KeyD = 0
BoxRas = 0
Turn = 1
zTurn = 0
END SUB
SUB LoadMaps
SW_LoadBytes "Maps/Map" & lev & "-1.bin", Map1
SW_LoadBytes "Maps/Map" & lev & "-2.bin", Map2
SW_LoadBytes "Maps/Map" & lev & "-3.bin", Map3
END SUB
SUB ShowLevel
SW_Sprite s8, 480, 450, zA
SW_Sprite s9, 576, 450, zA
SW_BmpText fo, 520, 450, FORMAT("%~00~",lev), 24, 24
vA += 1
IF vA = 8 THEN
vA = 0
zA = zA + 1
IF zA = 4 THEN zA = 0
END IF
END SUB
SUB ShowMaps
FOR icx = 0 TO 14
FOR idx = 0 TO 19
ibx = icx * 20 + idx
IF ASC(Map1[ibx]) = 3 THEN SW_Sprite s1, idx * 32, icx * 32, 3
IF ASC(Map3[ibx]) = 2 THEN SW_Sprite s1, idx * 32, icx * 32, 2
IF ASC(Map2[ibx]) = 5 THEN SW_Sprite s2, idx * 32, icx * 32, zR
NEXT
NEXT
vR += 1
IF vR = 10 THEN
vR = 0
zR += 1
END IF
IF zR = 4 THEN zR = 0
END SUB
SUB FindHead
FOR icx = 0 TO 14
FOR idx = 0 TO 19
ibx = icx * 20 + idx
IF ASC(Map3[ibx]) = 6 THEN
xHead = idx * 32
yHead = icx * 32
rHead = 0
zHead = 0
EXIT SUB
END IF
NEXT
NEXT
END SUB
SUB AllDone
IF Ready >= 1 THEN EXIT SUB
FOR icx = 0 TO 14
FOR idx = 0 TO 19
ibx = icx * 20 + idx
IF ASC(Map2[ibx]) = 5 AND ASC(Map3[ibx]) <> 4 THEN
EXIT SUB
END IF
NEXT
NEXT
Ready = 2
RasReg = 1
Turn = 0
pHead = 0
rTurn = SW_Rnd(1, 2)
xTurn = xHead
yTurn = yHead
END SUB
SUB TurnHead
IF Turn > 0 THEN EXIT SUB
IF rTurn = 1 THEN
SW_Sprite s6, xTurn, yTurn, zTurn
ELSE IF rTurn = 2 THEN
SW_Sprite s7, xTurn, yTurn, zTurn
END IF
zTurn = zTurn + 1
IF zTurn = 64 THEN zTurn = 0
END SUB
SUB FlashBox
FOR icx = 0 TO 14
FOR idx = 0 TO 19
ibx = icx * 20 + idx
IF ASC(Map2[ibx]) = 5 AND ASC(Map3[ibx]) = 4 THEN
SW_Sprite s4, idx * 32, icx * 32, cR
END IF
NEXT
NEXT
cV += 1
IF cV = 10 THEN
cV = 0
cR += 1
END IF
IF cR = 4 THEN cR = 0
END SUB
SUB ScanBoxes
IF BoxRas > 0 THEN EXIT SUB
FOR icx = 0 TO 14
FOR idx = 0 TO 19
ibx = icx * 20 + idx
IF ASC(Map3[ibx]) = 4 THEN
iBox[ibx] = 1
xBox[ibx] = idx * 32
yBox[ibx] = icx * 32
rBox[ibx] = 0
END IF
NEXT
NEXT
END SUB
SUB ShowBoxes
FOR ibx = 20 TO 280
IF iBox[ibx] = 1 AND rBox[ibx] = 0 THEN
SW_Sprite s1, xBox[ibx], yBox[ibx], 4
ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 1 THEN
xBox[ibx] = xBox[ibx] + 2
SW_Sprite s1, xBox[ibx], yBox[ibx], 4
zBox[ibx] = zBox[ibx] + 2
IF zBox[ibx] = 32 THEN
zBox[ibx] = 0
iBox[ibx] = 0
icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
Map3[icx] = CHR(4)
END IF
ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 2 THEN
xBox[ibx] = xBox[ibx] - 2
SW_Sprite s1, xBox[ibx], yBox[ibx], 4
zBox[ibx] = zBox[ibx] + 2
IF zBox[ibx] = 32 THEN
zBox[ibx] = 0
iBox[ibx] = 0
icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
Map3[icx] = CHR(4)
END IF
ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 3 THEN
yBox[ibx] = yBox[ibx] - 2
SW_Sprite s1, xBox[ibx], yBox[ibx], 4
zBox[ibx] = zBox[ibx] + 2
IF zBox[ibx] = 32 THEN
zBox[ibx] = 0
iBox[ibx] = 0
icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
Map3[icx] = CHR(4)
END IF
ELSE IF iBox[ibx] = 1 AND rBox[ibx] = 4 THEN
yBox[ibx] = yBox[ibx] + 2
SW_Sprite s1, xBox[ibx], yBox[ibx], 4
zBox[ibx] = zBox[ibx] + 2
IF zBox[ibx] = 32 THEN
zBox[ibx] = 0
iBox[ibx] = 0
icx = (yBox[ibx] * 20 + xBox[ibx]) / 32
Map3[icx] = CHR(4)
END IF
END IF
NEXT
END SUB
SUB ScanHead
IF RasReg > 0 THEN EXIT SUB
idx = xHead / 32
icx = yHead / 32
ibx = icx * 20 + idx
IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_right) AND ASC(Map3[ibx + 1]) = 4 AND ASC(Map3[ibx + 2]) = 0 AND KeyR = 0 THEN
Map3[ibx] = CHR(0)
Map3[ibx + 1] = CHR(6)
rHead = 1
pHead = 1
BoxRas = 0
xBox[ibx + 1] = xHead + 32
yBox[ibx + 1] = yHead
rBox[ibx + 1] = 1
iBox[ibx + 1] = 1
Steps += 1
SW_PlayWav w2
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_left) AND ASC(Map3[ibx - 1]) = 4 AND ASC(Map3[ibx - 2]) = 0 AND KeyL = 0 THEN
Map3[ibx] = CHR(0)
Map3[ibx - 1] = CHR(6)
rHead = 2
pHead = 2
BoxRas = 0
xBox[ibx - 1] = xHead - 32
yBox[ibx - 1] = yHead
rBox[ibx - 1] = 2
iBox[ibx - 1] = 1
Steps += 1
SW_PlayWav w2
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_up) AND ASC(Map3[ibx - 20]) = 4 AND ASC(Map3[ibx - 40]) = 0 AND KeyU = 0 THEN
Map3[ibx] = CHR(0)
Map3[ibx - 20] = CHR(6)
rHead = 3
pHead = 3
BoxRas = 0
xBox[ibx - 20] = xHead
yBox[ibx - 20] = yHead - 32
rBox[ibx - 20] = 3
iBox[ibx - 20] = 1
Steps += 1
SW_PlayWav w2
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_down) AND ASC(Map3[ibx + 20]) = 4 AND ASC(Map3[ibx + 40]) = 0 AND KeyD = 0 THEN
Map3[ibx] = CHR(0)
Map3[ibx + 20] = CHR(6)
rHead = 4
pHead = 4
BoxRas = 0
xBox[ibx + 20] = xHead
yBox[ibx + 20] = yHead + 32
rBox[ibx + 20] = 4
iBox[ibx + 20] = 1
Steps += 1
SW_PlayWav w2
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_right) AND ASC(Map3[ibx + 1]) = 0 AND KeyR = 0 THEN
rHead = 1
pHead = 1
Map3[ibx] = CHR(0)
Map3[ibx + 1] = CHR(6)
Steps += 1
SW_PlayWav w1
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_left) AND ASC(Map3[ibx - 1]) = 0 AND KeyL = 0 THEN
rHead = 2
pHead = 2
Map3[ibx] = CHR(0)
Map3[ibx - 1] = CHR(6)
Steps += 1
SW_PlayWav w1
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_up) AND ASC(Map3[ibx - 20]) = 0 AND KeyU = 0 THEN
rHead = 3
pHead = 3
Map3[ibx] = CHR(0)
Map3[ibx - 20] = CHR(6)
Steps += 1
SW_PlayWav w1
ELSE IF ASC(Map3[ibx]) = 6 AND SW_Key(vk_down) AND ASC(Map3[ibx + 20]) = 0 AND KeyD = 0 THEN
rHead = 4
pHead = 4
Map3[ibx] = CHR(0)
Map3[ibx + 20] = CHR(6)
Steps += 1
SW_PlayWav w1
ELSE
rHead = 0
END IF
END SUB
SUB ShowHead
IF rHead = 0 AND pHead = 1 THEN
SW_Sprite s3, xHead, yHead, 3
ELSE IF rHead = 0 AND pHead = 2 THEN
SW_Sprite s3, xHead, yHead, 1
ELSE IF rHead = 0 AND pHead = 3 THEN
SW_Sprite s3, xHead, yHead, 0
ELSE IF rHead = 0 AND pHead = 4 THEN
SW_Sprite s3, xHead, yHead, 2
ELSE IF rHead = 1 THEN
xHead += 2
SW_Sprite s3, xHead, yHead, 3
RasReg += 2
IF RasReg = 32 THEN
RasReg = 0
rHead = 0
END IF
ELSE IF rHead = 2 THEN
xHead -= 2
SW_Sprite s3, xHead, yHead, 1
RasReg += 2
IF RasReg = 32 THEN
RasReg = 0
rHead = 0
END IF
ELSE IF rHead = 3 THEN
yHead -= 2
SW_Sprite s3, xHead, yHead, 0
RasReg += 2
IF RasReg = 32 THEN
RasReg = 0
rHead = 0
END IF
ELSE IF rHead = 4 THEN
yHead += 2
SW_Sprite s3, xHead, yHead, 2
RasReg += 2
IF RasReg = 32 THEN
RasReg = 0
rHead = 0
END IF
END IF
END SUB
SUB MousePos
xPos = FIX(SW_xMouse() / 32)
yPos = FIX(SW_yMouse() / 32)
IF SW_MouseButton() = 1 THEN
IF xPos = 15 AND yPos = 14 AND lev > 1 AND ButtonC = 0 THEN
lev -= 1
ButtonC = 1
SW_PlayWav w4
Initialize
LoadMaps
FindHead
EXIT SUB
END IF
END IF
IF SW_MouseButton() = 1 THEN
IF xPos = 18 AND yPos = 14 AND lev < 30 AND ButtonC = 0 THEN
lev += 1
ButtonC = 1
SW_PlayWav w4
Initialize
LoadMaps
FindHead
END IF
END IF
IF SW_MouseButton() = 0 THEN ButtonC = 0
END SUB
' MAIN
SW_Window 640, 480, 1
SW_SetCaption "ScriptBasic SokoMouse"
SW_SetFps(60)
Q = SW_LoadBmp("SokoMedia/sokomouse.bmp", 1)
p1 = SW_LoadBmp("SokoMedia/smbg.bmp", 1)
Fo = SW_LoadBmp("SokoMedia/FontStrip.bmp", 96)
s1 = SW_LoadBmp("SokoMedia/SokoStrip.bmp", 5)
s2 = SW_LoadBmp("SokoMedia/RundStrip.bmp", 4)
s3 = SW_LoadBmp("SokoMedia/HeadStrip.bmp", 4)
s4 = SW_LoadBmp("SokoMedia/BoxsStrip.bmp", 4)
s6 = SW_LoadBmp("SokoMedia/HeadStripR.bmp", 64)
s7 = SW_LoadBmp("SokoMedia/HeadStripL.bmp", 64)
s8 = SW_LoadBmp("SokoMedia/ArroStripL.bmp", 4)
s9 = SW_LoadBmp("SokoMedia/ArroStripR.bmp", 4)
w1 = "SokoMedia/move.wav"
w2 = "SokoMedia/push.wav"
w3 = "SokoMedia/done.wav"
w4 = "SokoMedia/clic.wav"
SW_Cls 0xCCCCCC
SW_Sprite Q, 180, 60, 0
SW_BmpText fo, 205, 32, "SOKOMOUSE", 24, 24
SW_BmpText fo, 170, 428, "PRESS ANY KEY", 24, 24
SW_WaitKey
lev = 1
Initialize
LoadMaps
ShowLevel
FindHead
WHILE SW_Key(27) = 0
ShowMaps
IF sl THEN ShowLevel
ScanBoxes
ScanHead
ShowBoxes
ShowHead
FlashBox
AllDone
MousePos
TurnHead
IF SW_Key(vk_space) THEN
SW_BmpText fo, 64, 420, "Wait...", 24, 24
Initialize
LoadMaps
FindHead
END IF
IF Ready = 2 AND NOT(Notified) THEN
SW_BmpText fo, 64, 450, Steps & " moves to solve.", 20, 20
SW_Sync
SW_PlayWav w3
sl = 1
Notified = TRUE
END IF
BoxRas += 2
IF BoxRas = 32 THEN BoxRas = 0
IF SW_Key(vk_right) = 0 THEN KeyR = 1
IF SW_Key(vk_right)THEN
KeyR = 0
SW_Wait(10)
END IF
IF SW_Key(vk_left) = 0 THEN KeyL = 1
IF SW_Key(vk_left) THEN
KeyL = 0
SW_Wait(10)
END IF
IF SW_Key(vk_up) = 0 THEN KeyU = 1
IF SW_Key(vk_up) THEN
KeyU = 0
SW_Wait(10)
END IF
IF SW_Key(vk_down) = 0 THEN KeyD = 1
IF SW_Key(vk_down) THEN
KeyD = 0
SW_Wait(10)
END IF
SW_Sync
WEND
SW_CloseWindow
BS.sbx' ScriptBasic Angry Birds Lite
INCLUDE "sbsw.inc"
' ********
SUB InitVars
' ********
SPLITA STRING(40,"0") BY "" TO xMeg
SPLITA STRING(40,"0") BY "" TO yMeg
SPLITA STRING(40,"0") BY "" TO zMeg
SPLITA STRING(40,"0") BY "" TO xUfo
SPLITA STRING(40,"0") BY "" TO yUfo
SPLITA STRING(40,"0") BY "" TO zUfo
SPLITA STRING(40,"0") BY "" TO rUfo
SPLITA STRING(40,"0") BY "" TO iUfo
SPLITA STRING(40,"0") BY "" TO nUfo
SPLITA STRING(40,"0") BY "" TO xRok
SPLITA STRING(40,"0") BY "" TO yRok
SPLITA STRING(40,"0") BY "" TO rRok
SPLITA STRING(40,"0") BY "" TO xBum
SPLITA STRING(40,"0") BY "" TO yBum
SPLITA STRING(40,"0") BY "" TO iBum
SPLITA STRING(40,"0") BY "" TO zBum
SPLITA STRING(40,"0") BY "" TO vBum
xRak = 0
yRak = 0
rRak = 0
zRak = 0
iBx = 0
iDx = 0
iCx = 0
iAx = 0
zFrame = 0
z1 = 0
z2 = 0
z3 = 0
z4 = 0
bmap = 0
w1 = 0
w2 = 0
w3 = 0
s = 0
y = 0
sc = 0
uz = 0
jx = 0
drop = 0
Ok = 0
count = 0
px = 0
jv = 0.0
zv = 0.0
dv = 0.0
za = 0.0
END SUB
' *************
FUNCTION CircleCollide(x1, y1, r1, x2, y2, r2)
' *************
IF SQR((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) < r1 + r2 THEN
CircleCollide = 1
END IF
END FUNCTION
' ******
SUB Timer1
' ******
dv = dv + 0.1
IF dv >= 1 THEN
dv = 0
zFrame += 1
IF zFrame = 8 THEN zFrame = 0
END IF
END SUB
' ******
SUB Timer2
' ******
jv = jv + 1
IF jv = 50 THEN
jv = 0
jx = jx + 1
IF jx = 21 THEN jx = 0
END IF
END SUB
' ******
SUB Timer3
' ******
Drop = SW_Rnd(0,40)
END SUB
' ******
SUB Timer4
' ******
IF Ok = 1 THEN EXIT SUB
za += .2
IF za >= 5 THEN
za = 0
count = count - 1
IF count <= 0 THEN count = 0
END IF
END SUB
' *********
SUB SetExplos(xx, yy, ii)
' *********
FOR iDx = 0 TO 39
IF yBum[iDx] = 0 THEN
xBum[iDx] = xx
yBum[iDx] = yy
iBum[iDx] = ii
EXIT SUB
END IF
NEXT
END SUB
' **********
SUB ShowExplos
' **********
FOR iDx = 0 TO 39
IF iBum[iDx] = 1 THEN
SW_DrawTile bmap, xBum[iDx], yBum[iDx], 64, 64, zBum[iDx], 1
vBum[iDx] = vBum[iDx] + 0.1
IF vBum[iDx] >= 1 THEN
vBum[iDx] = 0
zBum[iDx] = zBum[iDx] + 1
END IF
IF zBum[iDx] = 8 THEN
zBum[iDx] = 0
yBum[iDx] = 0
iBum[iDx] = 0
vBum[iDx] = 0
END IF
END IF
NEXT
END SUB
' *********
SUB SetRocket(xx, yy)
' *********
FOR iAx = 0 TO 39
IF yRok[iAx] = 0 THEN
xRok[iAx] = xx
yRok[iAx] = yy
rRok[iAx] = 1
EXIT SUB
END IF
NEXT
END SUB
' **********
SUB ScanRocket
' **********
FOR iAx = 0 TO 39
IF rRok[iAx] = 1 AND yRok[iAx] <= -32 THEN
rRok[iAx] = 0
yRok[iAx] = 0
END IF
NEXT
END SUB
' **********
SUB ShowRocket
' **********
FOR iAx = 0 TO 39
IF rRok[iAx] = 1 THEN
SW_DrawTile bmap, xRok[iAx], yRok[iAx], 64, 64, zFrame, 0
yRok[iAx] = yRok[iAx] - 4
IF yRok[iAx] = 400 THEN zRak = 0
END IF
NEXT
END SUB
' **********
SUB ScanRakete
' **********
IF rRak = 5 THEN EXIT SUB
IF SW_Key(32) AND SW_Key(39) AND zRak = 0 THEN
SetRocket(xRak, yRak)
rRak = 1
zRak = 1
SW_PlayWav w1
ELSE IF SW_Key(32) AND SW_Key(37) AND zRak = 0 THEN
SetRocket(xRak, yRak)
rRak = 2
zRak =1
SW_PlayWav w1
ELSE IF SW_Key(32) AND zRak = 0 THEN
SetRocket(xRak, yRak)
zRak = 1
SW_PlayWav w1
ELSE IF SW_Key(39) AND xRak < 736 THEN
rRak = 1
ELSE IF SW_Key(37) AND xRak > 0 THEN
rRak = 2
ELSE
rRak = 0
END IF
END SUB
' **********
SUB ShowRakete
' **********
IF rRak = 0 THEN
SW_DrawTile bmap, xRak, yRak, 64, 64, zFrame, 4
ELSE IF rRak = 1 THEN
SW_DrawTile bmap, xRak, yRak, 64, 64, zFrame, 4
xRak = xRak + 1
ELSE IF rRak = 2 THEN
SW_DrawTile bmap, xRak, yRak, 64, 64, zFrame, 4
xRak = xRak - 1
END IF
END SUB
' ***************
SUB RocketCollision
' ***************
FOR iBx = 0 TO uz
FOR iCx = 0 TO 39
IF rRok[iCx] > 0 AND rUfo[iBx] > 0 THEN
IF CircleCollide(xRok[iCx] + 32, yRok[iCx] + 32, 16, xUfo[iBx] + 32, yUfo[iBx] + 32, 16) = 1 THEN
SetExplos(xUfo[iBx], yUfo[iBx], 1)
rRok[iCx] = 0
yRok[iCx] = 0
rUfo[iBx] = 0
yUfo[iBx] = 0
SW_PlayWav w2
sc = sc + 25
EXIT SUB
END IF
END IF
NEXT
NEXT
END SUB
' ***************
SUB RaketeCollision
' ***************
IF Ok = 1 THEN EXIT SUB
FOR iAx = 0 TO 40
IF yMeg[iAx] > 0 THEN
IF CircleCollide(xRak, yRak, 16, xMeg[iAx], yMeg[iAx], 16) = 1 THEN
SetExplos(xRak, yRak, 1)
rRak = 5
Ok = 1
SW_PlayWav w3
EXIT SUB
END IF
END IF
NEXT
END SUB
' *******
SUB SetUfos
' *******
FOR iAx = 0 TO uz
xUfo[iAx] = SW_Rnd(16,736)
yUfo[iAx] = SW_Rnd(16,300)
rUfo[iAx] = SW_Rnd(1,4)
zUfo[iAx] = 0
nUfo[iAX] = 0
NEXT
END SUB
' ********
SUB ScanUfos
' ********
FOR iBx = 0 TO uz
IF rUfo[iBx] = 1 AND xUfo[iBx] >= 736 THEN
rUfo[iBx] = 2
ELSE IF rUfo[iBx] = 2 AND xUfo[iBx] <= 0 THEN
rUfo[iBx] = 1
ELSE IF rUfo[iBx] = 3 AND yUfo[iBx] <= 0 THEN
rUfo[iBx] = 4
ELSE IF rUfo[iBx] = 4 AND yUfo[iBx] >= 350 THEN
rUfo[iBx] = 3
ELSE IF jx = 5 AND rUfo[iBx] = 4 THEN
rUfo[iBx] = SW_Rnd(1,4)
ELSE IF jx = 10 AND rUfo[iBx] = 3 THEN
rUfo[iBx] = SW_Rnd(1,4)
ELSE IF jx = 15 AND rUfo[iBx] = 2 THEN
rUfo[iBx] = SW_Rnd(1,4)
ELSE IF jx = 20 AND rUfo[iBx] = 1 THEN
rUfo[iBx] = SW_Rnd(1,4)
END IF
NEXT
END SUB
' ********
SUB ShowUfos
' ********
FOR iBx = 0 TO uz
IF rUfo[iBx] = 1 THEN
SW_DrawTile bmap, xUfo[iBx], yUfo[iBx], 64, 64, zFrame, 2
xUfo[iBx] = xUfo[iBx] + 1
ELSE IF rUfo[iBx] = 2 THEN
SW_DrawTile bmap, xUfo[iBx], yUfo[iBx], 64, 64, zFrame, 2
xUfo[iBx] = xUfo[iBx] - 1
ELSE IF rUfo[iBx] = 3 THEN
SW_DrawTile bmap, xUfo[iBx], yUfo[iBx], 64, 64, zFrame, 2
yUfo[iBx] = yUfo[iBx] - 1
ELSE IF rUfo[iBx] = 4 THEN
SW_DrawTile bmap, xUfo[iBx], yUfo[iBx], 64, 64, zFrame, 2
yUfo[iBx] = yUfo[iBx] + 1
END IF
NEXT
END SUB
' *******
SUB SetData
' *******
xRak = 384
yRak = 536
rRak = 0
za = 0
uz = 40
sc = 0
Ok = 0
count = 300
SetUfos
FOR iBx = 0 TO 40
yMeg[iBx] = 0
xMeg[iBx] = 0
NEXT
END SUB
' ********
SUB TestUfos
' ********
FOR iAx = 0 TO 40
IF yUfo[iAx] > 0 OR Ok = 1 THEN EXIT SUB
NEXT
Ok = 1
sc += count
END SUB
' ************
SUB ScanUfoBombs
' ************
FOR iAx = 0 TO drop STEP 2
IF rUfo[iAx] > 0 THEN
IF yMeg[iAx] = 0 THEN
xMeg[iAx] = xUfo[iAx]
yMeg[iAx] = yUfo[iAx] + 32
END IF
END IF
NEXT
END SUB
' ********
SUB UfoBombs
' ********
FOR iDx = 0 TO 40
IF yMeg[iDx] > 0 THEN
IF iDx < 20 THEN
SW_DrawTile bmap, xMeg[iDx], yMeg[iDx], 64, 64, zFrame, 3
ELSE IF iDx >= 20 THEN
SW_DrawTile bmap, xMeg[iDx], yMeg[iDx], 64, 64, zFrame, 3
END IF
yMeg[iDx] = yMeg[iDx] + 1
IF yMeg[iDx] >= 600 THEN yMeg[iDx] = 0
END IF
NEXT
END SUB
' *******
' MAIN *
' *******
InitVars
SW_Window 800, 600, 1
SW_SetFont 28, 48, 0, ""
bmap = SW_LoadTile("bmp/bitmap.bmp", 8, 5)
w1 = "bmp/shoot.wav"
w2 = "bmp/explo.wav"
w3 = "bmp/xship.wav"
SW_ShowMouse 0
SetData
SW_SetFPS 60
WHILE SW_Key(27) = 0
SW_Cls 0
SW_SetCaption "Frames " & SW_ShowFPS()
IF Ok = 1 THEN
SW_SetText 460, 0, "SCORE " & sc, SW_RGB(255,255,255)
ELSE IF Ok = 0 THEN
SW_SetText 460, 0, "SCORE " & sc, SW_RGB(255,255,255)
END IF
ScanUfos
ShowUfos
ScanRocket
ShowRocket
ScanRakete
ShowRakete
ScanUfoBombs
UfoBombs
ShowExplos
RocketCollision
RaketeCollision
TestUfos
Timer1
Timer2
Timer3
Timer4
IF Ok = 1 THEN
SW_SetText 240, 300, "ONCE AGAIN?", SW_RGB(255,255,255)
SW_SetText 240, 344, "HIT [c] KEY", SW_RGB(255,255,255)
IF SW_Key(67) THEN SetData()
END IF
SW_SetText 16, 0, "BONUS " & count, SW_RGB(255,255,255)
SW_Sync
WEND
SW_Quit
The competition aspect of these games is being featured on the
All Basic Forum if you would like to participate.