Well I think the deadline has passed.
Only two in it this time.
Rich get points for the least lines of code.
Arch gets lots of points for the fun level in the Blast Balls game.
I have to give the win to Arch. Very well done. I'll keep going back to that game in future.
So now I have to try to get my Tower Defence game done in time. I won't know if I can until the end of the month.
Cheers guys and I'll leave you with the latest version of my Lady Bugs mini game.
I added six levels of difficulty and made it more complete by adding spacebar to restart instead of having to reboot.
// Project: Lady Bugs by ando - may contain a bug
// Created: 21-12-24
SetErrorMode(2)
//SetVSync(1)
Global width# as Float
Global height# as Float
width# = GetMaxDeviceWidth() // I had to use # to stabilise mouselook over different pc's
height# = GetMaxDeviceHeight()
SetWindowSize(width#,height#,1)
SetVirtualResolution(width#,height#) // doesn't have to match the window
SetSyncRate(30,0)
SetScissor(0,0,0,0) // use the maximum available screen space
UseNewDefaultFonts(1)
SetPrintSize(height#/25)
SetSkyboxVisible(1)
SetSkyBoxHorizonColor(0,0,0)
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Screenshot setup
screenGrab = CreateRenderImage(GetMaxDeviceWidth(),GetMaxDeviceHeight(),0,1)
filesavetext=createtext("")
settextvisible(filesavetext,0)
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx map
Global map as integer [19,19]
Global object as integer [19,19]
Global monsterPos as integer [19,19]
Global monster1 as integer
Global player as integer
Global item as integer
Global x,y as integer
restart_here:
AddRow(1 ,"1111111111111111111") // 0 = vacant
AddRow(2 ,"1000000007000000001") // 1 = wall
AddRow(3 ,"1012431011101243101") // 2 = horizontal door left
AddRow(4 ,"1010001000001000101") // 3 = horizontal door right
AddRow(5 ,"1010101124311010101") // 4 = door center
AddRow(6 ,"1050101000001010501") // 5 = virtical door upper
AddRow(7 ,"1040101011101010401") // 6 = virtical door lower
AddRow(8 ,"1060000000000000601") // 7 = player
AddRow(9 ,"1012431010101243101") // 8 = monster
AddRow(10,"1010001010101000101") // 9 = item to collect
AddRow(11,"1010101018101010101")
AddRow(12,"1050101000001010501")
AddRow(13,"1040101010101010401")
AddRow(14,"1060101010101010601")
AddRow(15,"1010101010101010101")
AddRow(16,"1010000010100000101")
AddRow(17,"1011124310124311101")
AddRow(18,"1000000009000000001")
AddRow(19,"1111111111111111111")
Function AddRow(y,data$)
for x = 1 to 19
tile = VAL(MID(data$,x,1))
if tile=0
map[x,y]=0
endif
if tile=1
map[x,y]=1
object[x,y]=CreateText(chr(127)) // 127 wall
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],50,255,50,150)
endif
if tile=2
map[x,y]=2
object[x,y]=CreateText(chr(60)) // 60 door left
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],50,150,255,255)
object[x+1,y-1]=CreateText(chr(94)) // 94 door upper invisible
SetTextSize(object[x+1,y-1],height#/20)
SetTextPosition(object[x+1,y-1],(width#/41)*(x+12)-width#/41+width#*0.0022,(height#/25)*(y+2)-height#/25)
SetTextColor(object[x+1,y-1],50,150,255,255)
settextvisible(object[x+1,y-1],0)
object[x+1,y+1]=CreateText(chr(118)) // 118 door lower invisible
SetTextSize(object[x+1,y+1],height#/20)
SetTextPosition(object[x+1,y+1],(width#/41)*(x+12)-width#/41+width#*0.0022,(height#/25)*(y+4)-height#/25)
SetTextColor(object[x+1,y+1],50,150,255,255)
settextvisible(object[x+1,y+1],0)
endif
if tile=3
map[x,y]=3
object[x,y]=CreateText(chr(62)) // 62 door right
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],50,150,255,255)
endif
if tile=4
map[x,y]=4
object[x,y]=CreateText(chr(847)) // 847 door center
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0085,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],150,200,255,255)
endif
if tile=5
map[x,y]=5
object[x,y]=CreateText(chr(94)) // 94 door upper
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],50,150,255,255)
object[x-1,y+1]=CreateText(chr(60)) // 60 door left invisible
SetTextSize(object[x-1,y+1],height#/20)
SetTextPosition(object[x-1,y+1],(width#/41)*(x+10)-width#/41+width#*0.0022,(height#/25)*(y+4)-height#/25)
SetTextColor(object[x-1,y+1],50,150,255,255)
settextvisible(object[x-1,y+1],0)
object[x+1,y+1]=CreateText(chr(62)) // 62 door right invisible
SetTextSize(object[x+1,y+1],height#/20)
SetTextPosition(object[x+1,y+1],(width#/41)*(x+12)-width#/41+width#*0.0022,(height#/25)*(y+4)-height#/25)
SetTextColor(object[x+1,y+1],50,150,255,255)
settextvisible(object[x+1,y+1],0)
endif
if tile=6
map[x,y]=6
object[x,y]=CreateText(chr(118)) // 118 door lower
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],50,150,255,255)
endif
if tile=7 // PLAYER
map[x,y]=7
object[x,y]=CreateText(chr(79))
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41,(height#/25)*(y+3)-height#/25)
player=object[x,y]
endif
if tile=8 // MONSTER
map[x,y]=0
monsterPos[x,y]=1
monster1=CreateText(chr(88))
SetTextSize(monster1,height#/20)
SetTextPosition(monster1,(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(monster1,255,50,50,255)
endif
if tile=9 // item
map[x,y]=9
object[x,y]=CreateText(chr(164))
SetTextSize(object[x,y],height#/20)
SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
SetTextColor(object[x,y],255,255,50,255)
item=object[x,y]
endif
next x
EndFunction
score=0
restart=0
level=5
monsterdelay=0
pPosX=10
pPosY=2
placeItem=0
monsterDir$="up"
mPosX=10
mPosY=11
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MAIN LOOP
do
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Screenshot Section
if GetRawKeyPressed(80) // P to screenshot
SetRenderToImage(screenGrab, -1)
Print(" LEVEL "+str(6-level))
Print(" score "+str(score))
if gettextvisible(filesavetext) then settextvisible(filesavetext,0)
number = 1
ClearScreen()
Render()
checkFiles:
if GetFileExists("raw:"+GetReadPath()+"screenshots/Screenshot"+str(number)+".png")
number = number + 1
goto checkFiles
endif
SaveImage(screenGrab, "raw:"+GetReadPath()+"screenshots/Screenshot"+str(number)+".png")
settextstring(filesavetext,"Image saved as Screenshot"+str(number)+".png in "+ GetReadPath()+"screenshots")
SetTextSize(filesavetext,GetMaxDeviceHeight()*0.0275)
textTimer = 1
SetRenderToScreen()
if not gettextvisible(filesavetext) then settextvisible(filesavetext,1)
endif
If textTimer > 0 Then textTimer = textTimer + 1
If textTimer > 299
settextvisible(filesavetext,0)
textTimer = 0
EndIf
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end screenshot code
if gameover=0
if score = 100
level=4
elseif score = 200
level=3
elseif score = 300
level=2
elseif score = 400
level=1
elseif score > 495
level=0
endif
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx monster X
if monsterdelay<level
if level<6 then monsterdelay=monsterdelay+1
endif
if level=monsterdelay
if monsterDir$="up"
if map[mPosX,mPosY-1]=0 or map[mPosX,mPosY-1]=7 or map[mPosX,mPosY-1]=9
monsterPos[mPosX,mPosY]=0
monsterPos[mPosX,mPosY-1]=1
mPosY=mPosY-1
SetTextPosition(monster1,GetTextX(monster1),GetTextY(monster1)-height#/25)
else
mpick=random(1,3)
if mpick=1
monsterDir$="down"
endif
if mpick=2
monsterDir$="left"
endif
if mpick=3
monsterDir$="right"
endif
endif
monsterdelay=0
if map[mPosX-1,mPosY]=0 or map[mPosX+1,mPosY]=0 or map[mPosX-1,mPosY]=7 or map[mPosX+1,mPosY]=7
mpick=random(1,5)
if mpick=1
monsterDir$="up"
endif
if mpick=2
monsterDir$="left"
endif
if mpick=3
monsterDir$="right"
endif
endif
endif
if monsterDir$="down"
if map[mPosX,mPosY+1]=0 or map[mPosX,mPosY+1]=7 or map[mPosX,mPosY+1]=9
monsterPos[mPosX,mPosY]=0
monsterPos[mPosX,mPosY+1]=1
mPosY=mPosY+1
SetTextPosition(monster1,GetTextX(monster1),GetTextY(monster1)+height#/25)
else
mpick=random(1,3)
if mpick=1
monsterDir$="up"
endif
if mpick=2
monsterDir$="left"
endif
if mpick=3
monsterDir$="right"
endif
endif
monsterdelay=0
if map[mPosX-1,mPosY]=0 or map[mPosX+1,mPosY]=0 or map[mPosX-1,mPosY]=7 or map[mPosX+1,mPosY]=7
mpick=random(1,5)
if mpick=1
monsterDir$="down"
endif
if mpick=2
monsterDir$="left"
endif
if mpick=3
monsterDir$="right"
endif
endif
endif
if monsterDir$="left"
if map[mPosX-1,mPosY]=0 or map[mPosX-1,mPosY]=7 or map[mPosX-1,mPosY]=9
monsterPos[mPosX,mPosY]=0
monsterPos[mPosX-1,mPosY]=1
mPosX=mPosX-1
SetTextPosition(monster1,GetTextX(monster1)-width#/41,GetTextY(monster1))
else
mpick=random(1,3)
if mpick=1
monsterDir$="up"
endif
if mpick=2
monsterDir$="down"
endif
if mpick=3
monsterDir$="right"
endif
endif
monsterdelay=0
if map[mPosX,mPosY-1]=0 or map[mPosX,mPosY+1]=0 or map[mPosX,mPosY-1]=7 or map[mPosX,mPosY+1]=7
mpick=random(1,5)
if mpick=1
monsterDir$="up"
endif
if mpick=2
monsterDir$="left"
endif
if mpick=3
monsterDir$="down"
endif
endif
endif
if monsterDir$="right"
if map[mPosX+1,mPosY]=0 or map[mPosX+1,mPosY]=7 or map[mPosX+1,mPosY]=9
monsterPos[mPosX,mPosY]=0
monsterPos[mPosX+1,mPosY]=1
mPosX=mPosX+1
SetTextPosition(monster1,GetTextX(monster1)+width#/41,GetTextY(monster1))
else
mpick=random(1,3)
if mpick=1
monsterDir$="up"
endif
if mpick=2
monsterDir$="down"
endif
if mpick=3
monsterDir$="left"
endif
endif
monsterdelay=0
if map[mPosX,mPosY-1]=0 or map[mPosX,mPosY+1]=0 or map[mPosX,mPosY-1]=7 or map[mPosX,mPosY+1]=7
mpick=random(1,5)
if mpick=1
monsterDir$="up"
endif
if mpick=2
monsterDir$="right"
endif
if mpick=3
monsterDir$="down"
endif
endif
endif
endif
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx item
if placeItem=1
pickX=random(2,18)
pickY=random(2,18)
if map[pickX,pickY]=0
if map[pickX+1,pickY]<>4 and map[pickX-1,pickY]<>4 and map[pickX,pickY+1]<>4 and map[pickX,pickY-1]<>4
map[pickX,pickY]=9
SetTextPosition(item,(width#/41)*(pickX+11)-width#/41+width#*0.0022,(height#/25)*(pickY+3)-height#/25)
placeItem=0
settextvisible(item,1)
endif
endif
endif
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx player
if playerdelay < 4
playerdelay=playerdelay+1
endif
if playerdelay=4
if GetRawKeyState(38) // up
if map[pPosX,pPosY-1]=0
map[pPosX,pPosY-1]=7
map[pPosX,pPosY]=0
pPosY=pPosY-1
SetTextPosition(player,GetTextX(player),GetTextY(player)-height#/25)
elseif map[pPosX,pPosY-1]=2 // left door
settextvisible(object[pPosX,pPosY-1],0)
settextvisible(object[pPosX+2,pPosY-1],0)
settextvisible(object[pPosX+1,pPosY],1)
settextvisible(object[pPosX+1,pPosY-2],1)
map[pPosX,pPosY-1]=0
map[pPosX+2,pPosY-1]=0
map[pPosX+1,pPosY]=6
map[pPosX+1,pPosY-2]=5
elseif map[pPosX,pPosY-1]=3 // right door
settextvisible(object[pPosX,pPosY-1],0)
settextvisible(object[pPosX-2,pPosY-1],0)
settextvisible(object[pPosX-1,pPosY],1)
settextvisible(object[pPosX-1,pPosY-2],1)
map[pPosX,pPosY-1]=0
map[pPosX-2,pPosY-1]=0
map[pPosX-1,pPosY]=6
map[pPosX-1,pPosY-2]=5
elseif map[pPosX,pPosY-1]=9 // item
map[pPosX,pPosY-1]=0
settextvisible(item,0)
placeItem=1
score=score+10
endif
playerdelay=0
elseif GetRawKeyState(40) // down
if map[pPosX,pPosY+1]=0
map[pPosX,pPosY+1]=7
map[pPosX,pPosY]=0
pPosY=pPosY+1
SetTextPosition(player,GetTextX(player),GetTextY(player)+height#/25)
elseif map[pPosX,pPosY+1]=2 // left door
settextvisible(object[pPosX,pPosY+1],0)
settextvisible(object[pPosX+2,pPosY+1],0)
settextvisible(object[pPosX+1,pPosY],1)
settextvisible(object[pPosX+1,pPosY+2],1)
map[pPosX,pPosY+1]=0
map[pPosX+2,pPosY+1]=0
map[pPosX+1,pPosY]=5
map[pPosX+1,pPosY+2]=6
elseif map[pPosX,pPosY+1]=3 // right door
settextvisible(object[pPosX,pPosY+1],0)
settextvisible(object[pPosX-2,pPosY+1],0)
settextvisible(object[pPosX-1,pPosY],1)
settextvisible(object[pPosX-1,pPosY+2],1)
map[pPosX,pPosY+1]=0
map[pPosX-2,pPosY+1]=0
map[pPosX-1,pPosY]=5
map[pPosX-1,pPosY+2]=6
elseif map[pPosX,pPosY+1]=9 // item
map[pPosX,pPosY+1]=0
settextvisible(item,0)
placeItem=1
score=score+10
endif
playerdelay=0
elseif GetRawKeyState(37) // left
if map[pPosX-1,pPosY]=0
map[pPosX-1,pPosY]=7
map[pPosX,pPosY]=0
pPosX=pPosX-1
SetTextPosition(player,GetTextX(player)-width#/41,GetTextY(player))
elseif map[pPosX-1,pPosY]=5 // upper door
settextvisible(object[pPosX-1,pPosY],0)
settextvisible(object[pPosX-1,pPosY+2],0)
settextvisible(object[pPosX,pPosY+1],1)
settextvisible(object[pPosX-2,pPosY+1],1)
map[pPosX-1,pPosY]=0
map[pPosX-1,pPosY+2]=0
map[pPosX-2,pPosY+1]=2
map[pPosX,pPosY+1]=3
elseif map[pPosX-1,pPosY]=6 // lower door
settextvisible(object[pPosX-1,pPosY],0)
settextvisible(object[pPosX-1,pPosY-2],0)
settextvisible(object[pPosX-2,pPosY-1],1)
settextvisible(object[pPosX,pPosY-1],1)
map[pPosX-1,pPosY]=0
map[pPosX-1,pPosY-2]=0
map[pPosX-2,pPosY-1]=2
map[pPosX,pPosY-1]=3
elseif map[pPosX-1,pPosY]=9 // item
map[pPosX-1,pPosY]=0
settextvisible(item,0)
placeItem=1
score=score+10
endif
playerdelay=0
elseif GetRawKeyState(39) // right
if map[pPosX+1,pPosY]=0
map[pPosX+1,pPosY]=7
map[pPosX,pPosY]=0
pPosX=pPosX+1
SetTextPosition(player,GetTextX(player)+width#/41,GetTextY(player))
elseif map[pPosX+1,pPosY]=5 // upper door
settextvisible(object[pPosX+1,pPosY],0)
settextvisible(object[pPosX+1,pPosY+2],0)
settextvisible(object[pPosX,pPosY+1],1)
settextvisible(object[pPosX+2,pPosY+1],1)
map[pPosX+1,pPosY]=0
map[pPosX+1,pPosY+2]=0
map[pPosX,pPosY+1]=2
map[pPosX+2,pPosY+1]=3
elseif map[pPosX+1,pPosY]=6 // lower door
settextvisible(object[pPosX+1,pPosY],0)
settextvisible(object[pPosX+1,pPosY-2],0)
settextvisible(object[pPosX,pPosY-1],1)
settextvisible(object[pPosX+2,pPosY-1],1)
map[pPosX+1,pPosY]=0
map[pPosX+1,pPosY-2]=0
map[pPosX,pPosY-1]=2
map[pPosX+2,pPosY-1]=3
elseif map[pPosX+1,pPosY]=9 // item
map[pPosX+1,pPosY]=0
settextvisible(item,0)
placeItem=1
score=score+10
endif
playerdelay=0
endif
endif
endif
if pPosX=mPosX
if pPosY=mPosY
gameover=1
endif
endif
Print(" LEVEL "+str(6-level))
Print(" score "+str(score))
if gameover=1
if restart=0
if GetRawKeyPressed(32) then restart=1 // space
Print(" HIT SPACE TO RESTART ")
endif
if restart=1
gameover=0
restart=0
DeleteText(monster1)
if gettextvisible(filesavetext) then settextvisible(filesavetext,0)
for x=1 to 19
for y=1 to 19
DeleteText(map[x,y])
if not object[x,y]=0 then DeleteText(object[x,y])
next y
next x
goto restart_here
endif
endif
Sync()
if GetrawKeyPressed(27) then end
loop
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.