'Music downloaded from [No Copyright Music] Halloween - (Royalty Free Halloween Music)
' Images taken from Images downloaded from www.freepik.com
'
CONST RedBack
= _RGB(210, 0, 0, 32), Color1
= _RGB(255, 255, 255, 32), Color2
= _RGB(255, 177, 0, 32), Color3
= _RGB(255, 150, 80, 32) CONST Color4
= _RGB(255, 100, 0, 32), Color5
= _RGB(255, 55, 0, 32), Color6
= _RGB(100, 130, 20, 32) CONST FireS
= 4, FireP
= 3, DeathS
= 2, DeathP
= 1 CONST False
= 0, True
= -1, Quit
= 999, Fire
= 100, FireVel
= 10, Right
= 150, Left
= 200, yShip
= 500 CONST CMusic
= 250, OMusic
= 300, widS
= 100, higS
= 100
' inizialize fonts----------------------------------------------------------
path$ = "C:\Windows\Fonts\"
files$
= "Tahoma.ttf" ' "lucon.ttf" <-- Alternative fonts of system loadfont path$
+ files$
, f
, 68loadfont path$
+ files$
, f2
, 36
' initialize music and sounds------------------------------------------------
loadMusic
' initialize images----------------------------------------------------------
c
= _LOADIMAGE("assets_H\sweet.png") 'FIRE OF USERd
= _LOADIMAGE("assets_H\spider.png") ' FIRE OF PUMPKINS' PUMPKINS
Xpump(g) = 80 * g: Ypump(g) = 70
Lpump(g) = True 'life
Fpump(g) = False 'firing
VelP = 5 ' pumpkins go towards right
' setting for starting------------------------------------------------------------
Credits
IntroStart f, f2
xShip = 200
GoDown = False
GameOver = 0
'main loop
cmd = 0 ' clear buffer commands
'---------------------------INPUT MANAGEMENT--------------------------------
' take commands
'---------------------------COMMAND TRANSLATOR------------------------------
' command Fire
FireActive = True
yFire = yShip
' command go right
IF cmd
= Right
THEN RightGo
= True
ELSE RightGo
= False
' command go left
IF cmd
= Left
THEN LeftGo
= True
ELSE LeftGo
= False
' command change music
IF OffMusic
= False
AND cmd
= CMusic
THEN ChangeMusic
= True
' command off music
'-------------------------EVENT MANAGEMENT-----------------------------------
' event Fire @----------------------------------------------
yFire = yFire - FireVel
yFire = 0
FireActive = False
' event go to right @----------------------------------------------
IF xShip
- 10 < 1 THEN xShip
= 1 ELSE xShip
= xShip
- 10 RightGo = False
' event go to left @----------------------------------------------
IF xShip
+ 10 + widS
> 800 THEN xShip
= 800 - widS
ELSE xShip
= xShip
+ 10 LeftGo = False
' event change music @----------------------------------------------
IF IndexMus
= 4 THEN IndexMus
= 1 ELSE IndexMus
= IndexMus
+ 1 ActualMus = mus(IndexMus)
ChangeMusic = False
' event Off music @----------------------------------------------
' event end music on playing @----------------------------------------------
' event Move Pumpkins @----------------------------------------------
IF VelP
> 0 THEN ' moving to right IF Xpump
(j
) + VelP
+ 60 > 800 THEN VelP = VelP * -1 ' it changes direction
GoDown = True ' pumpkins go towards ship
GoDown = False
VelP = VelP * -1 ' it changes direction
GoDown = True ' pumpkins go towards ship
GoDown = False
' it calculates the new position for pumpkins
Xpump(k) = Xpump(k) + VelP
IF GoDown
= True
THEN Ypump
(k
) = Ypump
(k
) + 10
' event Fire Pumpkins @----------------------------------------------
IF Lpump
(h
) = True
THEN ' if pumpkin exists IF Fpump
(h
) = False
THEN 'if pumpkin is not firing Fpump(h) = True ' it starts to fire
yFireP(h) = Ypump(h)
' event firing pumpkins @----------------------------------------------
IF yFireP
(h
) = Ypump
(h
) THEN _SNDPLAY snd
(FireP
): xFireP
(h
) = Xpump
(h
) + INT(widS
/ 2) - 20 IF yFireP
(h
) + FireVel
< 600 THEN yFireP(h) = yFireP(h) + FireVel
yFireP(h) = 540
Fpump(h) = False
' event destroy ship @----------------------------------------------
IF (xFireP
(h
) > xShip
AND xFireP
(h
) < xShip
+ widS
) OR (xFireP
(h
) + 40 > xShip
AND xFireP
(h
) + 40 < xShip
+ widS
) THEN IF (yFireP
(h
) > yShip
AND yFireP
(h
) < yShip
+ higS
) OR (yFireP
(h
) + 20 > yShip
AND yFireP
(h
) + 20 < yShip
+ higS
) THEN cmd = Quit
' event destroy fireship @----------------------------------------------
IF (xFireP
(h
) >= xFire
AND xFireP
(h
) <= xFire
+ 40) OR (xFireP
(h
) + 40 >= xFire
AND xFireP
(h
) + 40 <= xFire
+ 40) THEN IF (yFireP
(h
) >= yFire
AND yFireP
(h
) <= yFire
+ 20) OR (yFireP
(h
) + 20 >= yFire
AND yFireP
(h
) + 20 <= yFire
+ 20) THEN Fpump(h) = False
FireActive = False
' event destroy pumpkin @----------------------------------------------
IF Lpump
(l
) = True
THEN ' pumpkins is alive IF (xFire
> Xpump
(l
)) AND (Xpump
(l
) + 60 > xFire
) OR (xFire
+ 40 > Xpump
(l
)) AND (Xpump
(l
) + 60 > xFire
+ 40) THEN IF (yFire
< Ypump
(l
) + 60) AND (yFire
> Ypump
(l
)) OR (yFire
+ 20 < Ypump
(l
) + 60) AND (yFire
+ 20 > Ypump
(l
)) THEN Lpump(l) = False
FireActive = False
GameOver = GameOver + 1
'-----------------------------------------OUTPUT --------------------
' all graphic operations go onto hidden panel m
_PUTIMAGE (1, 1)-(800, 600), a
, m
'background layer _PUTIMAGE (xShip
, yShip
)-(xShip
+ widS
, yShip
+ higS
), b
, m
' astroship layer IF FireActive
THEN _PUTIMAGE (xFire
, yFire
)-(xFire
+ 40, yFire
+ 20), c
, m
' FireShip IF Lpump
(i
) THEN _PUTIMAGE (Xpump
(i
), Ypump
(i
))-(Xpump
(i
) + 60, Ypump
(i
) + 60), e
(i
), m
IF Fpump
(i
) THEN _PUTIMAGE (xFireP
(i
), yFireP
(i
))-(xFireP
(i
) + 40, yFireP
(i
) + 20), d
, m
'debug
LOOP UNTIL GameOver
= 9 OR cmd
= Quit
' events GameOver and Quit
SUB IntroStart
(fn1&
, fn2&
)
SUB loadfont
(pat$
, h&
, size
) PRINT "File font not found"
cp
= " MUSIC: downloaded from [No Copyright Music] Halloween - (Royalty Free Halloween Music)" + CHR$(13) + " on www.youtube.com" cp = " IMAGES: downloaded from freepik.com created: Pumpkin and Starship by Freepik, Moon by Kjpargeter, Sweet and spider by Titusurya"
PRINT "PRESS A KEY TO CONTINE..."
PRINT "LOADING MUSIC....." mus
(1) = _SNDOPEN("assets_H\UnknownFear.mp3") mus
(2) = _SNDOPEN("assets_H\Halloween.mp3") mus
(3) = _SNDOPEN("assets_H\WonderAndMagic.mp3") _SNDPLAY mus
(a
- 1) ' it plays the last music loaded ActualMus = mus(a - 1)
OffMusic = False
PRINT "LOADING SOUND....." snd
(1) = _SNDOPEN("assets_H\DeathPump.mp3") snd
(2) = _SNDOPEN("assets_H\DeathShip.mp3") snd
(3) = _SNDOPEN("assets_H\FirePump.mp3") snd
(4) = _SNDOPEN("assets_H\FireShip.mp3")