Post by PeterMaria on Apr 20, 2016 9:41:59 GMT -5
Hello,
Mushroom game by PeterMaria 2o.o4.2o16
mushroom puzzle game
your aim is to pick all mushrooms.
if a box blocks your way, push the box aside.
if gnoms block your way, you have to deflect they in another direction,
push a box in their way and the gnoms will change their direction.
for key controlling use your arrow keys and space bar and return key.
bonus:
the faster you are, the more points will you get.
do not press escape key by mistake!
to avoid this, create an executable.
choose file: create standalone.exe
then
choose "option" and mark out "Esc key or closing window quits".
choose "screen mode" and mark 640x480.
I hope is readable!
Mushroom game by PeterMaria 2o.o4.2o16
mushroom puzzle game
your aim is to pick all mushrooms.
if a box blocks your way, push the box aside.
if gnoms block your way, you have to deflect they in another direction,
push a box in their way and the gnoms will change their direction.
for key controlling use your arrow keys and space bar and return key.
bonus:
the faster you are, the more points will you get.
do not press escape key by mistake!
to avoid this, create an executable.
choose file: create standalone.exe
then
choose "option" and mark out "Esc key or closing window quits".
choose "screen mode" and mark 640x480.
I hope is readable!
TextMode(TEXT_BUFFERED)
ResizeSpriteArea(640,480)
dim Ax,Bx,Cx,Dx,pic,RasReg,BeeRas,xHead,yHead,rHead,zHead,pHead
dim Fa,lev=1,iCh,curX,curY,curZ,curU,curD,curL,curR,xBum,yBum,zBum,xCur=128
dim xMush,yMush,zMush,Mush,Oxy,iTime,Score,Over,count,mx,my,pz,img,yCur=128
dim s0(31),s1(3),s2(15),s3(4),s4(15),s5(15),s6(15),s7(15),s8(15),s9(15),sA(15),fo(63)
dim w1,w2,w3,w4,w5,w6,plz
dim Map1(360)
dim Map2(360)
dim xBee(360)
dim yBee(360)
dim zBee(360)
dim rBee(360)
dim iBee(360)
dim xBox(360)
dim yBox(360)
dim zBox(360)
dim rBox(360)
dim iBox(360)
oxy = LoadTex("Mush/oxygen.png")
pic = LoadTex("Mush/Nebula.png")
img = LoadTex("Mush/picture.png")
plz = LoadTex("Mush/Mushrooms.png")
fo = LoadImageStrip("Mush/fontstrip.png")
s0 = LoadImageStrip("Mush/donestrip.png")
s1 = LoadImageStrip("Mush/headstrip.png")
s2 = LoadImageStrip("Mush/boxxstrip.png")
s3 = LoadImageStrip("Mush/tilestrip.png")
s4 = LoadImageStrip("Mush/gnomstripL.png")
s5 = LoadImageStrip("Mush/gnomstripR.png")
s6 = LoadImageStrip("Mush/gnomstripU.png")
s7 = LoadImageStrip("Mush/gnomstripD.png")
s8 = LoadImageStrip("Mush/MushStrip.png")
s9 = LoadImageStrip("Mush/lostlifes.png")
sA = LoadImageStrip("Mush/markstrip.png")
w1 = LoadSound("Mush/clic.wav")
w2 = LoadSound("Mush/done.wav")
w3 = LoadSound("Mush/eats.wav")
w4 = LoadSound("Mush/bums.wav")
w5 = LoadSound("Mush/push.wav")
w6 = LoadSound("Mush/dark.wav")
Sub SetBee(r)
xBee(Bx) = Dx *32
yBee(Bx) = Cx *32
iBee(Bx) = 1
rBee(Bx) = r
End Sub
Sub Sprite(no(), x, y, w, h, frame)
NewSprite (no)
SprSetxCentre(0)
SprSetyCentre(0)
SprSetZOrder (1)
SprSetSize (w,h)
SprSetPos (x,y)
SprSetFrame (frame)
End Sub
Sub DrawImage(n, x, y, w, h)
NewSprite (n)
SprSetxCentre(0)
SprSetyCentre(0)
SprSetZOrder (1)
SprSetSize (w,h)
SprSetPos (x,y)
End Sub
Sub Text(id(),x1,y1,txt$,w1,h1)
dim sx, jx, px
sx = Len(txt$)
for jx=1 to sx
px = Asc(Mid$(txt$,jx,1))
if px >=32 and px <=127 then
px = px-32
NewSprite(id)
SprSetxCentre(0)
SprSetyCentre(0)
SprSetZOrder (1)
SprSetSize (w1,h1)
SprSetPos (x1,y1)
SprSetFrame (px)
x1 = x1 + w1
end if
next
End Sub
Function Key(taste)
return scankeydown(taste)
End Function
Function Rand(min,max)
Return rnd()% (max - min + 1) + min
End Function
Function BoxColl(x10, y10, w10, h10, x20, y20, w20, h20)
dim xm1, xm2, ym1, ym2
xm2=x10+w10: xm1=x20+w20: ym2=y10+h10: ym1=y20+h20
iF xm2 > x20 and x10 < xm1 and ym2 > y20 and y10 < ym1 then Return 1: endif
return 0
End Function
Sub ScanBees()
if BeeRas >0 then Return: endif
for Cx=1 to 13
for Dx=1 to 18
Bx = Cx*20 + Dx
if Map2(Bx) =6 And Map2(Bx-1) =5 then
Map2(Bx-1) =15
SetBee(2)
elseif Map2(Bx) =6 And Map2(Bx-1) =0 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =7 And Map2(Bx+1) =5 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =7 And Map2(Bx+1) =0 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =8 And Map2(Bx-20) =5 then
Map2(Bx-20) =15
SetBee(3)
elseif Map2(Bx) =8 And Map2(Bx-20) =0 then
Map2(Bx-20) =15
SetBee(3)
elseif Map2(Bx) =9 And Map2(Bx+20) =5 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =9 And Map2(Bx+20) =0 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =6 And Map2(Bx-1) =4 And Map2(Bx-20) =5 then
Map2(Bx-20) = 15
SetBee(3)
elseif Map2(Bx) =6 And Map2(Bx-1) =4 And Map2(Bx-20) =0 then
Map2(Bx-20) = 15
SetBee(3)
elseif Map2(Bx) =6 And Map2(Bx-1) =4 And Map2(Bx+20) =5 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =6 And Map2(Bx-1) =4 And Map2(Bx+20) =0 then
Map2(Bx+20) =15
SetBee(4)
elseif Map2(Bx) =7 And Map2(Bx+1) =4 And Map2(Bx-20) =5 then
Map2(Bx-20) =15
SetBee(3)
elseif Map2(Bx) =7 And Map2(Bx+1) =4 And Map2(Bx-20) =0 then
Map2(Bx-20) =15
SetBee(3)
elseif Map2(Bx) =7 And Map2(Bx+1) =4 And Map2(Bx+20) =5 then
Map2(Bx+20) =15
SetBee(4)
elseif Map2(Bx) =7 And Map2(Bx+1) =4 And Map2(Bx+20) =0 then
Map2(Bx+20) =15
SetBee(4)
elseif Map2(Bx) =8 And Map2(Bx-20) =4 And Map2(Bx+1) =5 then
Map2(Bx+1) =15
SetBee(1)
elseif Map2(Bx) =8 And Map2(Bx-20) =4 And Map2(Bx+1) =0 then
Map2(Bx+1) =15
SetBee(1)
elseif Map2(Bx) =8 And Map2(Bx-20) =4 And Map2(Bx-1) =5 then
Map2(Bx-1) =15
SetBee(2)
elseif Map2(Bx) =8 And Map2(Bx-20) =4 And Map2(Bx-1) =0 then
Map2(Bx-1) =15
SetBee(2)
elseif Map2(Bx) =9 And Map2(Bx+20) =4 And Map2(Bx+1) =5 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =9 And Map2(Bx+20) =4 And Map2(Bx+1) =0 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =9 And Map2(Bx+20) =4 And Map2(Bx-1) =5 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =9 And Map2(Bx+20) =4 And Map2(Bx-1) =0 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =6 And Map2(Bx-1) <> 0 And Map2(Bx+1) =5 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =6 And Map2(Bx-1) <> 0 And Map2(Bx+1) =0 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =6 And Map2(Bx-1) <> 0 And Map2(Bx+1) =5 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =6 And Map2(Bx-1) <> 0 And Map2(Bx+1) =0 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =7 And Map2(Bx+1) <> 0 And Map2(Bx-1) =5 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =7 And Map2(Bx+1) <> 0 And Map2(Bx-1) =0 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =8 And Map2(Bx-20) <> 0 And Map2(Bx+20) =5 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =8 And Map2(Bx-20) <> 0 And Map2(Bx+20) =0 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =9 And Map2(Bx+20) <> 0 And Map2(Bx-20) =5 then
Map2(Bx-20) = 15
SetBee(3)
elseif Map2(Bx) =9 And Map2(Bx+20) <> 0 And Map2(Bx-20) =0 then
Map2(Bx-20) = 15
SetBee(3)
elseif Map2(Bx) =6 And Map2(Bx-1) <> 0 And Map2(Bx+1) =4 And Map2(Bx-20) =0 then
Map2(Bx-20) = 15
SetBee(3)
elseif Map2(Bx) =6 And Map2(Bx-1) <> 0 And Map2(Bx+1) =4 And Map2(Bx+20) =0 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =7 And Map2(Bx+1) <> 0 And Map2(Bx-1) =4 And Map2(Bx-20) =0 then
Map2(Bx-20) = 15
SetBee(3)
elseif Map2(Bx) =7 And Map2(Bx+1) <> 0 And Map2(Bx-1) =4 And Map2(Bx+20) =0 then
Map2(Bx+20) = 15
SetBee(4)
elseif Map2(Bx) =8 And Map2(Bx-20) <> 0 And Map2(Bx+20) =4 And Map2(Bx+1) =0 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =8 And Map2(Bx-20) <> 0 And Map2(Bx+20) =4 And Map2(Bx-1) =0 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =9 And Map2(Bx+20) <> 0 And Map2(Bx-20) =4 And Map2(Bx+1) =0 then
Map2(Bx+1) = 15
SetBee(1)
elseif Map2(Bx) =9 And Map2(Bx+20) <> 0 And Map2(Bx-20) =4 And Map2(Bx-1) =0 then
Map2(Bx-1) = 15
SetBee(2)
elseif Map2(Bx) =6 And Map2(Bx-1) > 0 And Map2(Bx+1) > 0 then
SetBee(2)
iBee(Bx) =2
elseif Map2(Bx) =7 And Map2(Bx+1) > 0 And Map2(Bx-1) > 0 then
SetBee(1)
iBee(Bx) =2
elseif Map2(Bx) =8 And Map2(Bx+20) > 0 And Map2(Bx-20) >0 then
SetBee(3)
iBee(Bx) =2
elseif Map2(Bx) =9 And Map2(Bx-20) > 0 And Map2(Bx+20) >0 then
SetBee(4)
iBee(Bx) =2
endif
next
next
End Sub
Sub ShowBees()
for Bx=20 to 280
if iBee(Bx)=2 And rBee(Bx)=1 then
Sprite(s5,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then zBee(Bx)=0: endif
elseif iBee(Bx) =2 And rBee(Bx) =2 then
Sprite(s4,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then zBee(Bx)=0: endif
elseif iBee(Bx) =2 And rBee(Bx) =3 then
Sprite(s6,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then zBee(Bx)=0: endif
elseif iBee(Bx) =2 And rBee(Bx) =4 then
Sprite(s7,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then zBee(Bx)=0: endif
elseif iBee(Bx) =1 And rBee(Bx) =1 then
xBee(Bx) = xBee(Bx) +2
Sprite(s5,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then
zBee(Bx) =0 : iBee(Bx) =0
Ax = (yBee(Bx) *20 + xBee(Bx)) /32
Map2(Ax) =7 : Map2(Ax-1) =0
endif
elseif iBee(Bx) =1 And rBee(Bx) =2 then
xBee(Bx) = xBee(Bx) -2
Sprite(s4,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then
zBee(Bx) =0 : iBee(Bx) =0
Ax = (yBee(Bx) *20 + xBee(Bx)) /32
Map2(Ax)=6 : Map2(Ax+1)=0
endif
elseif iBee(Bx) =1 And rBee(Bx) =3 then
yBee(Bx) = yBee(Bx) -2
Sprite(s6,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then
zBee(Bx) =0 : iBee(Bx) =0
Ax = (yBee(Bx) *20 + xBee(Bx)) /32
Map2(Ax) =8 : Map2(Ax+20) =0
endif
elseif iBee(Bx) =1 And rBee(Bx) =4 then
yBee(Bx) = yBee(Bx) +2
Sprite(s7,xBee(Bx),yBee(Bx),32,32,zBee(Bx))
zBee(Bx) = zBee(Bx) +1
if zBee(Bx) =16 then
zBee(Bx) =0 : iBee(Bx) =0
Ax = (yBee(Bx) *20 + xBee(Bx)) /32
Map2(Ax) =9 : Map2(Ax-20) =0
endif
endif
next
End Sub
Sub ShowPause()
if Keydown("P") then
while scankeydown(32)=0
DrawImage(pic,0,0,640,480)
Text(fo,240,208,"PAUSE",32,32)
Text(fo,80,400,"PRESS SPACE BAR",32,32)
DrawText()
sleep(10)
ClearSprites()
wend
ClearKeys()
return
endif
End Sub
Sub ShowDone()
if Mush =0 And Over =0 then
Over = 2: Ax = 0
Score = Score + count
RasReg =1: rHead =8: zHead =0
PlaySound (w2)
endif
End Sub
Sub ShowDestroy()
if yBum >0 then
Sprite(s9,xBum,yBum,32,32,zBum)
zBum = zBum +1
if zBum =16 then zBum =0: endif
endif
End Sub
Sub Mushroom()
if yMush = 0 then Return: endif
Sprite(s8,xMush,yMush,32,32,zMush)
zMush = zMush +1
if zMush =16 then
zMush = 0
yMush = 0
Mush = Mush -1
endif
End Sub
Sub HeadAround()
if Over =2 then
Sprite(s0,xHead,yHead,32,32,zHead)
icH = icH +1
if icH =2 then
icH =0
zHead = zHead +1
if zHead =32 then: Over =3: endif
endif
endif
End Sub
Sub ShowBonus()
if Over >0 or count=0 then Return: endif
if iTime < 100 then iTime = iTime +1: endif
if iTime = 100 then
count = count-1
iTime = 0
if count= 0 then
Over = 0
PlaySound (w6)
endif
endif
End Sub
Sub BeeGetHead()
if RasReg=1 then Return: endif
for Bx=20 to 280
if iBee(bx) >0 then
if BoxColl(xBee(bx)+16,yBee(bx)+16,16,16,xHead+16,yHead+16,16,16)=1 then
RasReg = 1: rHead = 8: Over = 3
xBum = xHead: yBum = yHead
PlaySound (w4)
Return
endif
endif
next
End Sub
Sub ShowBoxes()
for Bx=20 to 280
if iBox(Bx)=1 And rBox(Bx)=1 then
xBox(Bx) = xBox(Bx) +2
Sprite(s2,xBox(Bx),yBox(Bx),32,32,zBox(Bx))
zBox(Bx) = zBox(Bx) +1
if zBox(Bx) =16 then
zBox(Bx) =0:iBox(Bx) =0:rBox(Bx) =0
Cx = (yBox(Bx) *20 + xBox(Bx)) /32
Map2(Cx) =4
endif
elseif iBox(Bx)=1 And rBox(Bx)=2 then
xBox(Bx) = xBox(Bx) -2
Sprite(s2,xBox(Bx),yBox(Bx),32,32,zBox(Bx))
zBox(Bx) = zBox(Bx) +1
if zBox(Bx) =16 then
zBox(Bx) =0:iBox(Bx) =0:rBox(Bx) =0
Cx = (yBox(Bx) *20 + xBox(Bx)) /32
Map2(Cx) =4
endif
elseif iBox(Bx) =1 And rBox(Bx) =3 then
yBox(Bx) = yBox(Bx) -2
Sprite(s2,xBox(Bx),yBox(Bx),32,32,zBox(Bx))
zBox(Bx) = zBox(Bx) +1
if zBox(Bx) =16 then
zBox(Bx) =0:iBox(Bx) =0:rBox(Bx) =0
Cx = (yBox(Bx) *20 + xBox(Bx)) /32
Map2(Cx) =4
endif
elseif iBox(Bx) =1 And rBox(Bx) =4 then
yBox(Bx) = yBox(Bx) +2
Sprite(s2,xBox(Bx),yBox(Bx),32,32,zBox(Bx))
zBox(Bx) = zBox(Bx) +1
if zBox(Bx) =16 then
zBox(Bx) =0:iBox(Bx) =0:rBox(Bx) =0
Cx = (yBox(Bx) *20 + xBox(Bx)) /32
Map2(Cx) =4
endif
endif
next
End Sub
Sub ShowHead()
if rHead=0 And pHead=1 then
Sprite(s1,xHead,yHead,32,32,3)
elseif rHead =0 And pHead =2 then
Sprite(s1,xHead,yHead,32,32,1)
elseif rHead =0 And pHead =3 then
Sprite(s1,xHead,yHead,32,32,0)
elseif rHead =0 And pHead =4 then
Sprite(s1,xHead,yHead,32,32,2)
elseif rHead =1 then
xHead = xHead +2
Sprite(s1,xHead,yHead,32,32,3)
RasReg = RasReg +2
if RasReg =32 then
RasReg =0: rHead =0
endif
elseif rHead =2 then
xHead = xHead -2
Sprite(s1,xHead,yHead,32,32,1)
RasReg = RasReg +2
if RasReg =32 then
RasReg =0: rHead =0
endif
elseif rHead =3 then
yHead = yHead -2
Sprite(s1,xHead,yHead,32,32,0)
RasReg = RasReg +2
if RasReg =32 then
RasReg =0: rHead =0
endif
elseif rHead =4 then
yHead = yHead +2
Sprite(s1,xHead,yHead,32,32,2)
RasReg = RasReg +2
if RasReg =32 then
RasReg =0: rHead =0
endif
endif
End Sub
Sub ScanHead()
if RasReg >0 then Return: endif
Dx = xHead /32
Cx = yHead /32
Bx = Cx *20 + Dx
if Map2(Bx)=5 And Key(vk_right) And Map2(Bx+1)=4 And Map2(Bx+2)=0 then
Map2(Bx)=0: Map2(Bx+1)=5: Map2(Bx+2)=10
rHead = 1
pHead = 1
xBox(Bx+1) = xHead+32
yBox(Bx+1) = yHead
rBox(Bx+1) = 1
iBox(Bx+1) = 1
PlaySound (w5)
elseif Map2(Bx)=5 And Key(vk_left) And Map2(Bx-1)=4 and Map2(Bx-2)=0 then
Map2(Bx)=0: Map2(Bx-1)=5: Map2(Bx-2)=10
rHead = 2
pHead = 2
xBox(Bx-1) = xHead-32
yBox(Bx-1) = yHead
rBox(Bx-1) = 2
iBox(Bx-1) = 1
PlaySound (w5)
elseif Map2(Bx)=5 And Key(vk_up) And Map2(Bx-20)=4 and Map2(Bx-40)=0 then
Map2(Bx)=0: Map2(Bx-20)=5: Map2(Bx-40)=10
rHead = 3
pHead = 3
xBox(Bx-20) = xHead
yBox(Bx-20) = yHead-32
rBox(Bx-20) = 3
iBox(Bx-20) = 1
PlaySound (w5)
elseif Map2(Bx)=5 And Key(vk_down) And Map2(Bx+20)=4 And Map2(Bx+40)=0 then
Map2(Bx)=0: Map2(Bx+20) = 5: Map2(Bx+40)=10
rHead = 4
pHead = 4
xBox(Bx+20) = xHead
yBox(Bx+20) = yHead+32
rBox(Bx+20) = 4
iBox(Bx+20) = 1
PlaySound (w5)
elseif Map2(Bx)=5 And Key(vk_right) And Map2(Bx+1)=0 then
rHead = 1
pHead = 1
Map2(Bx) = 0
Map2(Bx+1) = 5
PlaySound (w5)
elseif Map2(Bx)=5 And key(vk_left) And Map2(Bx-1)=0 then
rHead = 2
pHead = 2
Map2(Bx) = 0
Map2(Bx-1) = 5
PlaySound (w5)
elseif Map2(Bx) =5 And Key(vk_up) And Map2(Bx-20)=0 then
rHead = 3
pHead = 3
Map2(Bx) = 0
Map2(Bx-20) = 5
PlaySound (w5)
elseif Map2(Bx)=5 And Key(vk_down) And Map2(Bx+20)=0 then
rHead = 4
pHead = 4
Map2(Bx) = 0
Map2(Bx+20) = 5
PlaySound (w5)
elseif Map2(Bx)=5 And Key(vk_right) And Map2(Bx+1)=3 then
Map2(Bx) = 0
Map2(Bx+1) = 5
xMush = xHead +32
yMush = yHead
rHead = 1
pHead = 1
Score = Score +10
PlaySound (w3)
elseif Map2(Bx)=5 And Key(vk_left) And Map2(Bx-1)=3 then
Map2(Bx) = 0
Map2(Bx-1) = 5
xMush = xHead -32
yMush = yHead
rHead = 2
pHead = 2
Score = Score +10
PlaySound (w3)
elseif Map2(Bx)=5 And Key(vk_up) And Map2(Bx-20)=3 then
Map2(Bx) = 0
Map2(Bx-20) = 5
xMush = xHead
yMush = yHead -32
rHead = 3
pHead = 3
Score = Score +10
PlaySound (w3)
elseif Map2(Bx)=5 And Key(vk_down) And Map2(Bx+20)=3 then
Map2(Bx) = 0
Map2(Bx+20) = 5
xMush = xHead
yMush = yHead +32
rHead = 4
pHead = 4
Score = Score +10
PlaySound (w3)
else
rHead = 0
endif
End Sub
Sub FindHead()
for Cx =0 to 14
for Dx =0 to 19
Bx = Cx*20 + Dx
if Map2(Bx)=5 then
xHead = Dx *32
yHead = Cx *32
rHead = 0: zHead =0
elseif Map2(Bx)=3 then
Mush = Mush +1
endif
next
next
End Sub
Sub Initialize()
for Bx=0 to 299
xBee(Bx)=0: yBee(Bx)=0: zBee(Bx)=0: rBee(Bx)=0: iBee(Bx)=0
xBox(Bx)=0: yBox(Bx)=0: zBox(Bx)=0: rBox(Bx)=0: iBox(Bx)=0
next
pHead =3: BeeRas=0: RasReg =0
Score =0: iCh =0: count=200
iTime =0: Over=0: Mush =0
xBum =0: yBum=0: zBum =0: curX =128: curY =160
FindHead()
End Sub
Sub ShowMaps()
for Cx =0 To 14
for Dx =0 To 19
Bx = Cx*20 + Dx
if Map1(Bx)=2 then Sprite(s3,Dx*32,Cx*32,32,32,2): endif
if Map2(Bx)=1 then Sprite(s3,Dx*32,Cx*32,32,32,1): endif
if Map2(Bx)=3 then Sprite(s3,Dx*32,Cx*32,32,32,3): endif
if Map2(Bx)=4 then Sprite(s3,Dx*32,Cx*32,32,32,4): endif
next
next
End Sub
Sub LoadMaps()
Dim f1, f2, px
f1 = OpenFileRead("Maps\Map" + Lev + "-1.bin")
f2 = OpenFileRead("Maps\Map" + Lev + "-2.bin")
for px=0 To 299
Map1(px) = ReadByte(f1)
Map2(px) = ReadByte(f2)
next
CloseFile(f1)
CloseFile(f2)
End Sub
Sub MainGame()
while Key(32)=0
DrawImage(pic,0,0,640,480)
ShowMaps()
ScanHead()
ScanBees()
ShowBoxes()
Mushroom()
ShowHead()
ShowBees()
BeeGetHead()
ShowBonus()
ShowDestroy()
ShowDone()
HeadAround()
ShowPause()
BeeRas = BeeRas +2
if BeeRas=32 then BeeRas=0: endif
if Over=3 then
Text(fo,112,232,"PRESS SPACE!",32,32)
if key(vk_space) then return: endif
endif
Text(fo,32, 0,"SCORE:" + Score,32,32)
Text(fo,448,0,"MAP " + Lev,32,32)
Text(fo,230,480,"BASIC4GL",32,32)
Text(fo,160,450,"BONUS " + count,32,32)
DrawText()
Waittimer (20)
ClearSprites()
wend
End Sub
Sub MainMenu()
while 1=1
DrawImage(img,0,0,640,480)
Text(fo,112,32,"MUSHROOM GAME",32,32)
Text(fo,64,66, "PETER WIRBELAUER",32,32)
Text(fo,100,450, "BASIC4GL GAME",32,32)
Text(fo,128,128,"MAPS " + Lev,32,32)
Text(fo,128,160,"EXIT ",32,32)
if Key(vk_up) and yCur > 128 and CurU =0 then
yCur = yCur -32: CurU =1
PlaySound (w1)
endif
if Key(vk_down) and yCur < 160 and CurD =0 then
yCur = yCur +32: CurD = 1
PlaySound (w1)
endif
if Key(vk_left) and yCur =128 and Lev > 1 and CurL =0 then
Lev = Lev -1: CurL = 1
PlaySound (w1)
endif
if Key(vk_right) and yCur =128 and Lev <22 and CurR =0 then
Lev = Lev +1
CurR= 1
PlaySound (w1)
endif
if Key(vk_return) = true and yCur=128 then
ClearKeys()
LoadMaps()
Initialize()
MainGame()
elseif Key(vk_return) = true and yCur=160 then
return
endif
DrawImage(plz,xCur+48,yCur,32,32)
DrawText()
ClearSprites()
WaitTimer(10)
if Key(vk_up) =0 then CurU=0: endif
if Key(vk_Down) =0 then CurD=0: endif
if Key(vk_right)=0 then CurR=0: endif
if Key(vk_left) =0 then CurL=0: endif
wend
End Sub
MainMenu()
End