Post by PeterMaria on Apr 24, 2016 14:26:56 GMT -5
Hello,
Here's is a funny hard game.
You must fetch the stars and pills
after that, go to the flashing X.
arrow keys move the picker.
space bar restart a level.
escape quits this game.
(N) starts the next level.
Here's is a funny hard game.
You must fetch the stars and pills
after that, go to the flashing X.
arrow keys move the picker.
space bar restart a level.
escape quits this game.
(N) starts the next level.
TextMode(TEXT_BUFFERED)
ResizeSpriteArea(768,708)
Include Func.gb
dim xBoy,yBoy,zBoy,rBoy,xExit,yExit,zExit,aExit,xShrink,yShrink,zShrink,play
dim ras,pills,yPill,xPill,zPill,x,y,z,p,rx,zAtom,yStar,xStar,zStar,eras,px
dim xExp, yExp, zExp, iExp, m, stop, press, flash, zFlash, f1, f2, f3
dim xEny(8), yEny(8), rEny(8), zEny(8), vEny#(8)
dim vStar#, vExp#, vFlash#, vAtom#, vBoy#, vExit#, vShrink#, vPill#
dim map1(1200)
dim map2(1200)
dim map3(1200)
dim s1(59) = LoadImageStrip("gfx/char.png")
dim s2(15) = LoadImageStrip("gfx/atom.png")
dim s3(15) = LoadImageStrip("gfx/boyd.png")
dim s4(15) = LoadImageStrip("gfx/boyu.png")
dim s5(15) = LoadImageStrip("gfx/boyr.png")
dim s6(15) = LoadImageStrip("gfx/boyl.png")
dim s7(15) = LoadImageStrip("gfx/exitani.png")
dim s8(7) = LoadImageStrip("gfx/pillani.png")
dim s9(15) = LoadImageStrip("gfx/bummani.png")
dim sa(15) = LoadImageStrip("gfx/starani.png")
dim sb(15) = LoadImageStrip("gfx/shrani.png")
dim sc(15) = LoadImageStrip("gfx/fire.png")
dim sd(7) = LoadImageStrip("gfx/boyf.png")
dim w1 = LoadSound("gfx/success.wav")
dim w2 = LoadSound("gfx/caim.wav")
dim w3 = LoadSound("gfx/drown.wav")
dim w4 = LoadSound("gfx/hit.wav")
dim w5 = LoadSound("gfx/grab.wav")
f1 = OpenFileRead("lastlevel.bin")
m = ReadInt(f1)
CloseFile(f1)
f1 = OpenFileRead("Maps\Map" + m + "-1.txt")
f2 = OpenFileRead("Maps\Map" + m + "-2.txt")
f3 = OpenFileRead("Maps\Map" + m + "-3.txt")
for px=0 To 1199
Map1(px) = ReadByte(f1)
Map2(px) = ReadByte(f2)
Map3(px) = ReadByte(f3)
next
CloseFile(f1)
CloseFile(f2)
CloseFile(f3)
Sub BoyBumm()
if yExp >0 then
Sprite(s9,xExp,yExp,64,64,zExp)
if play=0 then
PlaySound(w4)
play=1
endif
vExp# = vExp# +0.2
if vExp# >=1 then
vExp#=0
zExp = zExp+1
if zExp =16 then
yExp =0
iExp =1
endif
endif
endif
End Sub
Sub KillEny()
for y=0 to 29
for x=0 to 39
z=y*40+x
if map3(z)=62 or map3(z)=63 or map3(z)=64 or map3(z)=65 then
map3(z)=32
return
endif
next
next
End Sub
Sub InitEny()
dim p
For y=0 to 29
For x=0 to 39
z=y*40+x
if map3(z)=62 then
xEny(p)=x*64
yEny(p)=y*64
rEny(p)=-1
p = p+1
elseif map3(z)=63 then
xEny(p)=x*64
yEny(p)=y*64
rEny(p)=-1
p = p+1
elseif map3(z)=64 then
xEny(p)=x*64
yEny(p)=y*64
rEny(p)=-1
p = p+1
elseif map3(z)=65 then
xEny(p)=x*64
yEny(p)=y*64
rEny(p)=-1
p = p+1
endif
if p=4 then return: endif
next
next
End Sub
Sub ScanEnemy()
if eras >0 then return: endif
For x=0 to 2
z=(yEny(x)*40+xEny(x))/64
if map3(z)=62 and map3(z+1)=111 then
map3(z)=32
map3(z+1)=62
rEny(x)=1
elseif map3(z)=63 and map3(z-1)=111 then
map3(z)=32
map3(z-1)=63
rEny(x)=2
elseif map3(z)=64 and map3(z-40)=111 then
map3(z)=32
map3(z-40)=64
rEny(x)=3
elseif map3(z)=65 and map3(z+40)=111 then
map3(z)=32
map3(z+40)=65
rEny(x)=4
elseif (map3(z)=62 and map3(z+40)=111) or (map3(z)=63 and map3(z+40)=111) then
map3(z)=32
map3(z+40)=65
rEny(x)=4
elseif (map3(z)=62 and map3(z-40)=111) or (map3(z)=63 and map3(z-40)=111) then
map3(z)=32
map3(z-40)=64
rEny(x)=3
elseif (map3(z)=64 and map3(z-1)=111) or (map3(z)=65 and map3(z-1)=111) then
map3(z)=32
map3(z-1)=63
rEny(x)=2
elseif (map3(z)=64 and map3(z+1)=111) or (map3(z)=65 and map3(z+1)=111) then
map3(z)=32
map3(z+1)=62
rEny(x)=1
elseif map3(z)=62 then
if map1(z)=105 and map3(z+1)=32 and map3(z+40)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=1
map3(z)=32
map3(z+1)=62
elseif rx=2 then
rEny(x)=4
map3(z)=32
map3(z+40)=65
endif
elseif map1(z)=105 and map3(z+1)=32 and map3(z-40)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=1
map3(z)=32
map3(z+1)=62
elseif rx=2 then
rEny(x)=3
map3(z)=32
map3(z-40)=64
endif
elseif map1(z)=105 and map3(z+40)=32 and map3(z-40)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=4
map3(z)=32
map3(z+40)=64
elseif rx=2 then
rEny(x)=3
map3(z)=32
map3(z-40)=64
endif
elseif map3(z+40)=32 and map3(z+1) >32 then
map3(z)=32
map3(z+40)=65
rEny(x)=4
elseif map3(z-40)=32 and map3(z+1) >32 then
map3(z)=32
map3(z-40)=64
rEny(x)=3
elseif map3(z+1) >32 and map3(z+40) >32 and map3(z-40) >32 and map3(z-1)=32 then
map3(z)=32
map3(z-1)=63
rEny(x)=2
elseif map3(z+1) >32 and map3(z+40) >32 and map3(z-40) >32 then
rEny(x)=-1
elseif map3(z)=62 and map3(z+1)=32 then
map3(z)=32
map3(z+1)=62
rEny(x)=1
endif
elseif map3(z)=63 then
if map1(z)=105 and map3(z-1)=32 and map3(z-40)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=2
map3(z)=32
map3(z-1)=63
elseif rx=2 then
rEny(x)=3
map3(z)=32
map3(z-40)=64
endif
elseif map1(z)=105 and map3(z+40)=32 and map3(z-40)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=4
map3(z)=32
map3(z+40)=64
elseif rx=2 then
rEny(x)=3
map3(z)=32
map3(z-40)=64
endif
elseif map1(z)=105 and map3(z-1)=32 and map3(z+40)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=2
map3(z)=32
map3(z-1)=63
elseif rx=2 then
rEny(x)=4
map3(z)=32
map3(z+40)=65
endif
elseif map3(z+40)=32 and map3(z-1) >32 then
map3(z)=32
map3(z+40)=65
rEny(x)=4
elseif map3(z-40)=32 and map3(z-1) >32 then
map3(z)=32
map3(z-40)=64
rEny(x)=3
elseif map3(z-1) >32 and map3(z+40) >32 and map3(z-40) >32 and map3(z+1)=32 then
map3(z)=32
map3(z+1)=62
rEny(x)=1
elseif map3(z-1) >32 and map3(z+40) >32 and map3(z-40) >32 then
rEny(x)=-1
elseif map3(z)=63 and map3(z-1)=32 then
map3(z)=32
map3(z-1)=63
rEny(x)=2
endif
elseif map3(z)=64 then
if map1(z)=105 and map3(z-40)=32 and map3(z+1)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=3
map3(z)=32
map3(z-40)=64
elseif rx=2 then
rEny(x)=1
map3(z)=32
map3(z+1)=62
endif
elseif map1(z)=105 and map3(z-40)=32 and map3(z-1)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=3
map3(z)=32
map3(z-40)=64
elseif rx=2 then
rEny(x)=2
map3(z)=32
map3(z-1)=63
endif
elseif map1(z)=105 and map3(z-1)=32 and map3(z+1)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=1
map3(z)=32
map3(z+1)=62
elseif rx=2 then
rEny(x)=2
map3(z)=32
map3(z-1)=63
endif
elseif map3(z-40) >32 and map3(z-1)=32 then
map3(z)=32
map3(z-1)=63
rEny(x)=2
elseif map3(z-40) >32 and map3(z+1)=32 then
map3(z)=32
map3(z+1)=62
rEny(x)=1
elseif map3(z-40) >32 and map3(z+1) >32 and map3(z-1) >32 and map3(z+40)=32 then
map3(z)=32
map3(z+40)=65
rEny(x)=4
elseif map3(z-40) >32 and map3(z+1) >32 and map3(z-1) >32 then
rEny(x)=-1
elseif map3(z)=64 and map3(z-40)=32 then
map3(z)=32
map3(z-40)=64
rEny(x)=3
else
rEny(x)=-1
endif
elseif map3(z)=65 then
if map1(z)=105 and map3(z+40)=32 and map3(z+1)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=4
map3(z)=32
map3(z+40)=65
elseif rx=2 then
rEny(x)=1
map3(z)=32
map3(z+1)=62
endif
elseif map1(z)=105 and map3(z+40)=32 and map3(z-1)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=4
map3(z)=32
map3(z+40)=65
elseif rx=2 then
rEny(x)=2
map3(z)=32
map3(z-1)=63
endif
elseif map1(z)=105 and map3(z+1)=32 and map3(z-1)=32 then
rx=Rand(1,2)
if rx=1 then
rEny(x)=1
map3(z)=32
map3(z+1)=62
elseif rx=2 then
rEny(x)=2
map3(z)=32
map3(z-1)=63
endif
elseif map3(z+40) >32 and map3(z-1)=32 then
map3(z)=32
map3(z-1)=63
rEny(x)=2
elseif map3(z+40) >32 and map3(z+1)=32 then
map3(z)=32
map3(z+1)=62
rEny(x)=1
elseif map3(z+40) >32 and map3(z+1) >32 and map3(z-1) >32 and map3(z-40)=32 then
map3(z)=32
map3(z-40)=64
rEny(x)=3
elseif map3(z+40) >32 and map3(z+1) >32 and map3(z-1) >32 then
rEny(x)=-1
elseif map3(z+40)=32 then
map3(z)=32
map3(z+40)=65
rEny(x)=4
endif
endif
next
End Sub
Sub SetEny(e)
vEny#(e) = vEny#(e)+0.2
if vEny#(e) >=1 then
vEny#(e)=0
zEny(e) = zEny(e)+1
if zEny(e)=16 then zEny(e)=0: endif
endif
End Sub
Sub ShowEnemy()
for z=0 to 3
if rEny(z)= -1 then
Sprite(sc,xEny(z),yEny(z),64,64,zEny(z))
SetEny(z)
elseif rEny(z)=1 then
xEny(z) = xEny(z)+1
Sprite(sc,xEny(z),yEny(z),64,64,zEny(z))
SetEny(z)
elseif rEny(z)=2 then
xEny(z) = xEny(z)-1
Sprite(sc,xEny(z),yEny(z),64,64,zEny(z))
SetEny(z)
elseif rEny(z)=3 then
yEny(z) = yEny(z)-1
Sprite(sc,xEny(z),yEny(z),64,64,zEny(z))
SetEny(z)
elseif rEny(z)=4 then
yEny(z) = yEny(z)+1
Sprite(sc,xEny(z),yEny(z),64,64,zEny(z))
SetEny(z)
endif
next
eras = eras+1
if eras=64 then eras=0: endif
End Sub
Sub ShowMaps()
for y=0 to 29
for x=0 to 39
z=y*40+x
if map1(z)=34 then Sprite(s1,x*64,y*64,64,64,1): endif
if map1(z)=107 then Sprite(s1,x*64,y*64,64,64,2): endif
if map1(z)=105 then Sprite(s1,x*64,y*64,64,64,2): endif
if map2(z)=91 then Sprite(s2,x*64,y*64,64,64,zAtom): endif
if map2(z)=121 then Sprite(s7,x*64,y*64,64,64,0): endif
if map2(z)=81 then Sprite(sa,x*64,y*64,64,64,zAtom): endif
next
next
vAtom# = vAtom#+0.2
if vAtom# >=1 then
vAtom#=0
zAtom = zAtom+1
if zAtom=16 then zAtom=0: endif
endif
End Sub
Sub InitBoy()
for y=0 to 29
for x=0 to 39
z=y*40+x
if map3(z)=111 then
xBoy=x*64
yBoy=y*64
endif
if map2(z)=91 or map2(z)=81 then
pills = pills+1
endif
if map2(z)=121 then
xExit=x*64
yExit=y*64
endif
next
next
End Sub
Sub CheckBoy()
if ras >0 or rBoy >=5 then return: endif
z=(yBoy*40+xBoy)/64
if map3(z) >=62 and map3(z) <=65 then
rBoy=6
xExp=xBoy
yExp=yBoy
elseif map2(z)=121 and aExit=1 then
xShrink=xBoy
yShrink=yBoy
map3(z)=32
rBoy=5
elseif map2(z)=91 then
xPill=xBoy
yPill=yBoy
pills = pills-1
map2(z)=32
map3(z)=32
rBoy=0
PlaySound(w2)
elseif map2(z)=81 then
xStar=xBoy
yStar=yBoy
pills = pills-1
map2(z)=32
map3(z)=32
rBoy=0
PlaySound(w5)
elseif ScanKeyDown(39) <0 and map3(z+1)=32 then
map3(z)=32
map3(z+1)=111
rBoy=1
elseif ScanKeyDown(37) <0 and map3(z-1)=32 then
map3(z)=32
map3(z-1)=111
rBoy=2
elseif ScanKeyDown(38) <0 and map3(z-40)=32 then
map3(z)=32
map3(z-40)=111
rBoy=3
elseif ScanKeyDown(40) <0 and map3(z+40)=32 then
map3(z)=32
map3(z+40)=111
rBoy=4
else
rBoy=0
endif
End Sub
Sub DrawBoy()
if rBoy=0 then
Sprite(s3,xBoy,yBoy,64,64,0)
elseif rBoy=1 then
xBoy = xBoy+1
Sprite(s5,xBoy,yBoy,64,64,zBoy)
vBoy# = vBoy#+0.2
if vBoy# >=1 then
vBoy#=0
zBoy = zBoy+1
if zBoy=16 then zBoy=0: endif
endif
ras = ras+1
if ras=64 Then ras=0: endif
elseif rBoy=2 then
xBoy = xBoy-1
Sprite(s6,xBoy,yBoy,64,64,zBoy)
vBoy# = vBoy# +0.2
if vBoy# >=1 then
vBoy#=0
zBoy = zBoy+1
if zBoy=16 then zBoy=0: endif
endif
ras = ras+1
if ras=64 Then ras=0: endif
elseif rBoy=3 then
yBoy = yBoy-1
Sprite(s4,xBoy,yBoy,64,64,zBoy)
vBoy# = vBoy#+0.2
if vBoy# >=1 then
vBoy#=0
zBoy = zBoy+1
if zBoy=16 then zBoy=0: endif
endif
ras = ras+1
if ras=64 Then ras=0: endif
elseif rBoy=4 then
yBoy = yBoy+1
Sprite(s3,xBoy,yBoy,64,64,zBoy)
vBoy# = vBoy#+0.2
if vBoy# >=1 then
vBoy#=0
zBoy = zBoy+1
if zBoy=16 then zBoy=0: endif
endif
ras = ras+1
if ras=64 Then ras=0: endif
endif
End Sub
Sub PillsAni()
if ypill >0 then
Sprite(s8,xpill,yPill,64,64,zPill)
vPill# = vPill#+0.1
if vPill# >=1 then
vPill#=0
zPill = zPill+1
if zPill=8 then
zPill=0
yPill=0
endif
endif
endif
End sub
Sub NoPills()
if Pills=0 then
if pills=0 and aExit=0 then PlaySound(w1): endif
aExit=1
endif
End Sub
Sub ExitActiv()
if aExit=1 then
Sprite(s7,xExit,yExit,64,64,zExit)
vExit# = vExit# +0.2
if vExit# >=1 then
vExit#=0
zExit = zExit+1
if zExit=16 then zExit=0: endif
endif
endif
End Sub
Sub BoyShrink()
if yShrink >0 then
Sprite(s9,xShrink,yShrink,64,64,zShrink)
if stop=0 then
PlaySound(w4)
stop=1
endif
vShrink# = vShrink#+0.2
if vShrink# >=1 then
vShrink#=0
zShrink = zShrink+1
if zShrink=16 then yShrink=0: endif
endif
endif
End Sub
Sub BoyFlash()
if flash=0 then
if ScanKeyDown(39) or ScanKeyDown(37) or ScanKeyDown(38) or ScanKeyDown(40) then
flash=1
z=(yBoy*40+xBoy)/64
map3(z)=32
return
endif
Sprite(sd,xBoy,yBoy,64,64,zFlash)
z=(yBoy*40+xBoy)/64
map3(z)=255
vFlash# = vFlash# +0.1
if vFlash# >=1 then
vFlash#=0
zFlash = zFlash+1
if zFlash=8 then zFlash=0: endif
endif
endif
End Sub
Sub StarShrink()
if yStar >0 then
Sprite(sb,xStar,yStar,64,64,zStar)
vStar# = vStar#+0.4
if vStar# >=1 then
vStar#=0
zStar = zStar+1
if zStar=16 then
zStar=0
yStar=0
endif
endif
endif
End Sub
Sub InitDat()
for x=0 to 4
xEny(x)=0
yEny(x)=0
rEny(x)=0
zEny(x)=0
vEny#(x)=0
next
xBoy =0: yBoy =0: zBoy =0: rBoy =0
xExit=0: yExit=0: zExit=0: aExit=0
xExp =0: yExp =0: zExp =0: iExp =0
yStar=0: xStar=0: zStar=0: ras =0
yPill=0: xPill=0: zPill=0: pills=0
eras =0: play =0: stop =0: zAtom=0: x=0: y=0: z=0: p=0: rx=0
xShrink=0: yShrink=0: zShrink=0: press=0: flash=0: zFlash=0: vFlash#=0
End Sub
Sub NewGame()
f1 = OpenFileRead("Maps\Map" + m + "-1.txt")
f2 = OpenFileRead("Maps\Map" + m + "-2.txt")
f3 = OpenFileRead("Maps\Map" + m + "-3.txt")
for px=0 To 1199
Map1(px) = ReadByte(f1)
Map2(px) = ReadByte(f2)
Map3(px) = ReadByte(f3)
next
CloseFile(f1)
CloseFile(f2)
CloseFile(f3)
InitDat()
KillEny()
InitEny()
InitBoy()
End Sub
Sub Main()
while ScanKeyDown(27)=0
if ScanKeyDown(32) and press=0 then
NewGame()
press=1
endif
if Keydown("N") and rBoy=5 then
m = m+1
if m=19 then m=1: endif
f1 = OpenFileWrite("lastLevel.bin")
Writeint(f1,m)
CloseFile(f1)
NewGame()
endif
ShowMaps()
ExitActiv()
BoyShrink()
BoyBumm()
DrawBoy()
ScanEnemy()
ShowEnemy()
CheckBoy()
BoyFlash()
PillsAni()
NoPills()
Starshrink()
if rBoy=5 then
Text(s1,128,320,"NEXT MAP PRESS N",32,84)
endif
if rBoy=6 then
Text(s1,140,340,"YOU WERE NABBED",32,64)
Text(s1,140,406,"PRESS SPACE BAR",32,64)
endif
Text(s1,320,660,"MAP " + m,24,34)
DrawText()
WaitTimer(8)
ClearSprites()
if ScanKeyDown(32)=0 then press=0: endif
wend
End Sub
KillEny()
InitEny()
InitBoy()
Main()
End