'################################################################
' H U N T E R ' S R E V E N G E 2 0 1 7 - 1 8
' By Ashish Kushwaha
' **** Hit F5 and Enjoy the Game!! ****
'Note :-
'The executable should be inside Hunter-Revenge folder
'If you are facing any problem, report it at Qb64.org Forum
'
'*** Tell Me You You Think About This Game On Twitter with @KingOfCoders ***
'
'################################################################
'$CONSOLE
'_CONSOLETITLE "Hunter's Revenge [DEBUG_OUTPUT]"
INPUT "Are you sure that you want to reset the game? (Y/N) ", dummy$
1
'App icon
$EXEICON:
'Hunter-Revenge-master/Images/game.ico'
'$include:'Vendor/spritetop.bi'
' ON ERROR GOTO 404
'Notification Section
'Frame Rate Section
DIM SHARED FPSEvent
, FPSEvt
, FPSCurrent%
, FPSRate%
, FPSBg&
'Loader Section
DIM SHARED Loader&
, LoaderX%
, LoaderY%
, LoaderCF%
, LoaderEvt!
LoaderX% = 730: LoaderY% = 500
'Game Types
'game objects
ending
AS _BYTE 'enemie is dead or not active
AS _BYTE 'enemie is active or not u
AS LONG 'delay (in milliseconds) after which enemie will show up in his scene in gameplay n
AS INTEGER 'delay between change of frame of animation f
AS INTEGER 'increment varible, if greater than above 'n', then frame is change snd
AS LONG 'hold sound handle sndPaused
AS _BYTE ' = true when sound is paused.
currentScene
AS INTEGER 'current scene of the gameplay completed
AS _BYTE 'level has been completed or not u
AS LONG 'current frame of the gameplay (always increases during gameplay) over
AS _BYTE ' level has been over or not background
AS STRING * 64 'background image path of the level bg
AS LONG 'background image handle of the level mode
AS INTEGER 'MODs of the game. Can be either THUNDERMODE, STORMMODE, FOGMODE, THUNDERMODE+FOGMODE, THUNDERMODE+STORMMODE cancel
AS _BYTE 'level has been cancel or not
'score flasher
' TYPE Vector_Particles_Text_Type
' x AS SINGLE 'x position
' y AS SINGLE 'y position
' vx AS SINGLE 'visual x
' vy AS SINGLE 'visual y
' delX AS SINGLE 'delta velocity
' delY AS SINGLE 'delta velocity
' dist AS SINGLE 'distance
' distX AS SINGLE ' distance x
' distY AS SINGLE 'distance y
' k AS SINGLE
' END TYPE
'$DYNAMIC
readConfig
'DIM SHARED Paused AS _BYTE
'REDIM SHARED Text_Particles(1) AS Vector_Particles_Text_Type
'DIM SHARED Text_Particles_Status, Text_Particles_Color AS _UNSIGNED LONG
DIM SHARED Menubg&
, GlobalEvent
, TimerEvent
, GameRenderingEvent
, Minutes%
, Seconds%
DIM SHARED explosions
(20) AS explosiontype
, Gun
AS guntype
, Bloods
(50) AS explosiontype
DIM SHARED HighScore%
, LevelStage%
, LevelStage2%
, CurrentScore%
DIM SHARED ScoreBoard&
, GunImg&
(1), OldScore%
, OldSeconds%
'Rains
DIM SHARED Rainx8&
, Rainx16&
, RainLight&
, RainSound&
, RainVol#
, ThunderCount
, ThunderEvent
'max level
'storm
'Sparks
'MODS
'SFXs
'Enemies scores image
FPSEvent
= _FREETIMER 'Event for showing current FPS (Frame Per Second)FPSEvt
= _FREETIMER 'Event for calculating current FPS (Frame Per Second)GlobalEvent
= _FREETIMER 'Event for game main menuTimerEvent
= _FREETIMER 'Event of timer which is displayed during gameplayGameRenderingEvent
= _FREETIMER 'Event in which level objects are rendered.NEvent
= _FREETIMER ' Global Event for notification
'Splash Screen
Splash
LoaderStart
loadComponents
'cursors
Mouse.cursor
= _LOADIMAGE("Images/cursor.png", 33)Mouse.cursor2
= _LOADIMAGE("Images/cursor2.png", 33)
'fonts
Fonts.biggest
= _LOADFONT("Font/ARDESTINE.ttf", 68)Fonts.bigger
= _LOADFONT("Font/ARDESTINE.ttf", 40)Fonts.smaller
= _LOADFONT("Font/arial.ttf", 12, "dontblend")Fonts.normal
= _LOADFONT("Font/ARDESTINE.ttf", 24)
'scores image
'fogs
Fogs.x = 0
Fogs.move = 1
'rains
'storm
StormImg&
= _LOADIMAGE("Images\storm.png", 33) 'we're using hardware image
'LifeBars
r = p5map(i + 1, 1, 100, 255, 0)
g = p5map(i + 1, 1, 100, 0, 255)
LINE (0, 0)-(i
+ 1, 6), _RGB(r
, g
, 0), BF
LINE (0, 0)-(99, 5), _RGB(255, 255, 255), B
Gun.damage = 3
Gun.id = 1
ScoreBoard&
= _LOADIMAGE("Images\score_board.png")
blood_Sheet%
= SPRITESHEETLOAD
("Images\blood.png", 64, 62, _RGB(0, 0, 0))Jet1_Sheet%
= SPRITESHEETLOAD
("Images\Jet.png", 120, 122, _RGB(0, 0, 0))Jet2_Sheet%
= SPRITESHEETLOAD
("Images\Jet_2.png", 120, 122, _RGB(0, 0, 0))Jet3_Sheet%
= SPRITESHEETLOAD
("Images\Jet_3.png", 150, 122, _RGB(0, 0, 0))eagle_Sheet%
= SPRITESHEETLOAD
("Images\eagle.png", 40, 40, _RGB(0, 0, 0))Crow_Sheet%
= SPRITESHEETLOAD
("Images\crow.png", 97, 120, _RGB(0, 0, 0))Bird_Sheet%
= SPRITESHEETLOAD
("Images\bird.png", 180, 170, _RGB(0, 0, 0))
explosion_Sheet%
= SPRITESHEETLOAD
("Images\explosion.png", 100, 100, _RGB(0, 0, 0))
ExplosionsZ(i).img = SPRITENEW(explosion_Sheet%, 1, SAVE)
SPRITEANIMATESET ExplosionsZ(i).img, 1, 81
ExplosionsZ(i).y = 300
ExplosionsZ(0).x = 100: ExplosionsZ(1).x = 700
Bloods(i).img = SPRITENEW(blood_Sheet%, 1, SAVE)
SPRITEANIMATESET Bloods(i).img, 1, 6
explosions(i).img = SPRITENEW(explosion_Sheet%, 1, SAVE)
SPRITEANIMATESET explosions(i).img, 1, 81
Bloods(i).totalFrames = 6
Bloods(i).n = 5
explosions(i).totalFrames = 81
explosions(i).n = 4
MenuBlood% = SPRITENEW(blood_Sheet%, 1, SAVE)
SPRITEANIMATESET MenuBlood%, 1, 6
'Setup Notificaton stuff
GameMenus(0).y = 150
GameMenus(1).y = GameMenus(0).y + 60
GameMenus(2).y = GameMenus(1).y + 60
GameMenus(3).y = GameMenus(2).y + 60
GameMenus(4).y = GameMenus(3).y + 60
GameMenus(5).y = 113
GameMenus(6).y = GameMenus(5).y + 34
GameMenus(7).y = GameMenus(6).y + 34
GameMenus(8).y = GameMenus(7).y + 34
GameMenus(9).y = GameMenus(8).y + 34
GameMenus(10).y = GameMenus(9).y + 34
GameMenus(11).y = GameMenus(10).y + 34
GameMenus(12).y = GameMenus(11).y + 34
_PRINTSTRING (CenterPrintX
("Default Settings"), 0), "Default Settings" GameMenus(13).y = GameMenus(12).y + 34
_PRINTSTRING (CenterPrintX
("Apply Settings"), 0), "Apply Settings" GameMenus(14).y = GameMenus(13).y + 34
_PRINTSTRING (CenterPrintX
("Go Back To Main Menu"), 0), "Go Back To Main Menu" GameMenus(15).y = GameMenus(14).y + 34
GameMenus(16).y = 232
GameMenus(17).y = GameMenus(16).y + 34
GameMenus(18).y = GameMenus(17).y + 34
_PRINTSTRING (CenterPrintX
("Exit to Main Menu"), 0), "Exit to Main Menu" GameMenus(19).y = GameMenus(18).y + 34
LoaderEnd
start:
' echo COMMAND$(1)
' echo COMMAND$(2)
' IF COMMAND$(1) = "-loadlevel" AND VAL(COMMAND$(2)) > 0 THEN
' LevelStage% = VAL(COMMAND$(2))
' LevelStage2% = LevelStage%
' GOTO newgame
' END IF
GameMenu
IF MenuChoice
= 1 THEN MenuChoice
= 0:
GOTO newgame
MenuChoice = 0
'save current settings in dummy variable :P
DIM preConfig
AS Settings
preConfig = W ' W is a global variable which stored all game settings
DIM on_switch&
, off_switch&
, bd&
, cj&
, gfx&
, ac&
'images surface _PUTIMAGE (200, GameMenus
(i
).y
), GameMenus
(i
).img2
BLURIMAGE cj&, 5
CLS , 0 'make it transparent _PUTIMAGE (0, GameMenus
(i
).y
- 103), GameMenus
(i
).img2
_PUTIMAGE (150, 103), gfx&
, 0, (0, 0)-(500, p5map
(i
, 0, 255, 0, 340)) Mouse.lclick = 0
Mouse.rclick = 0
Mouse.lclick = -1
Mouse.rclick = -1
IF Mouse.x
> 150 AND Mouse.x
< 650 AND Mouse.y
> GameMenus
(i
).y
- 10 AND Mouse.y
< GameMenus
(i
).y
+ 24 THEN LINE (150, GameMenus
(i
).y
- 10)-(650, GameMenus
(i
).y
+ 24), _RGBA(255, 100, 0, 100), BF
IF W.fullscreen
> 0 THEN W.fullscreen
= 0 ELSE W.fullscreen
= 1 W.fullscreen = W.fullscreen + 1
IF W.fullscreen
> 2 THEN W.fullscreen
= 1 W.musicV = W.musicV + .1
IF W.musicV
> 1.0 THEN W.musicV
= .1 W.sfxV = W.sfxV + .1
IF W.sfxV
> 1 THEN W.sfxV
= 0.1 W.fps = W.fps + 30
IF W.fps
> 240 THEN W.fps
= 30 W.fullscreen = 0
W.music = -1
W.sfx = -1
W.musicV = 1
W.sfxV = 1
W.SE = -1
W.fps = 30
writeConfig
loadComponents
showNotification "Settings have been applied."
_PUTIMAGE (150, GameMenus
(i
).y
), GameMenus
(i
).img
_PRINTSTRING (630 - txtWidth
("Stretch"), GameMenus
(i
).y
), "Stretch" _PRINTSTRING (630 - txtWidth
("Square Pixels"), GameMenus
(i
).y
), "Square Pixels" _PRINTSTRING (630 - txtWidth
("Disable"), GameMenus
(i
).y
), "Disable" _PRINTSTRING (630 - txtWidth
(" 10"), GameMenus
(i
).y
), " 10 " _PRINTSTRING (630 - txtWidth
(" 10"), GameMenus
(i
).y
), " 10 " _PUTIMAGE (Mouse.x
- 16, Mouse.y
- 16), Mouse.cursor2
_PUTIMAGE (Mouse.x
- 16, Mouse.y
- 16), Mouse.cursor
_PUTIMAGE (150, 103), gfx&
, 0, (0, 0)-(500, p5map
(i
, 0, 255, 0, 340)) MenuChoice = 0
_PUTIMAGE (200, GameMenus
(i
).y
), GameMenus
(i
).img2
BLURIMAGE cj&, 5
centerImage k&
'mouse input
Mouse.lclick = -1
Mouse.lclick = 0
Mouse.rclick = -1
Mouse.rclick = 0
centerImage k&
_PUTIMAGE (200, GameMenus
(i
).y
), GameMenus
(i
).img2
showCredits
MenuChoice = 0
MenuChoice = 0
newgame:
LoaderStart
SetupRain
LoadLevel
IF getCurrentLevel
> MAX_LEVEL
THEN randomLevels
= -1 ELSE randomLevels
= 0: LoadLevel
'################### Random Levels ################################
Level.completed = 0
Level.over = 0
LevelStage% = p5random(1, MAX_LEVEL)
'LevelStage% = VAL(COMMAND$(2))
INPUT #F
, Level.background
OldSeconds% = Seconds%
' if randomLevels then LoaderEnd : goto game_rendering_begin
' _DELAY 0.5
'############################# Custom Levels #############################
ERASE Enemie
'clear all previous enemie data
'Enemie Configuirations
Level.completed = 0
Level.over = 0
Level.cancel = 0
CurrentScore% = 0
Level.u = 0
Level.currentScene = 1
FOR i
= 1 TO Level.enemies
Enemie(i).img = SPRITENEW(Bird_Sheet%, 1, SAVE)
SPRITEANIMATESET Enemie(i).img, 1, 14
SPRITEZOOM Enemie(i).img, 50
Enemie(i).n = 6
Enemie(i).points = 10
Enemie(i).life = 4
Enemie(i).life2 = Enemie(i).life
Enemie(i).img = SPRITENEW(Crow_Sheet%, 1, SAVE)
SPRITEANIMATESET Enemie(i).img, 1, 4
SPRITEZOOM Enemie(i).img, 70
Enemie(i).n = 12
Enemie(i).points = 20
Enemie(i).life = 7
Enemie(i).life2 = Enemie(i).life
Enemie(i).img = SPRITENEW(eagle_Sheet%, 7, SAVE)
SPRITEANIMATESET Enemie(i).img, 7, 9
Enemie(i).n = 12
Enemie(i).points = 35
Enemie(i).life = 14
Enemie(i).life2 = Enemie(i).life
Enemie(i).img = SPRITENEW(Jet1_Sheet%, 1, SAVE)
SPRITEANIMATESET Enemie(i).img, 1, 3
SPRITEZOOM Enemie(i).img, 70
Enemie(i).n = 10
Enemie(i).points = 50
Enemie(i).life = 30
Enemie(i).life2 = Enemie(i).life
Enemie(i).img = SPRITENEW(Jet2_Sheet%, 1, SAVE)
SPRITEANIMATESET Enemie(i).img, 1, 3
SPRITEZOOM Enemie(i).img, 70
Enemie(i).n = 10
Enemie(i).points = 75
Enemie(i).life = 45
Enemie(i).life2 = Enemie(i).life
Enemie(i).img = SPRITENEW(Jet3_Sheet%, 1, SAVE)
SPRITEANIMATESET Enemie(i).img, 1, 3
SPRITEZOOM Enemie(i).img, 70
Enemie(i).n = 10
Enemie(i).points = 100
Enemie(i).life = 70
Enemie(i).life2 = Enemie(i).life
IF Enemie
(i
).m
< 0 THEN Enemie
(i
).x
= _WIDTH: SPRITEFLIP Enemie
(i
).img
, HORIZONTAL
ELSE Enemie
(i
).x
= 0
INPUT #F
, Enemie
(i
).scene
LoaderEnd
game_rendering_begin:::
_PUTIMAGE (50, 550)-(170, 590), GunImg&
(Gun.id
- 1)
Minutes%
= (Seconds%
- (Seconds%
MOD 60)) / 60
StartLevel
FOR i
= 1 TO Level.enemies
'free all the sound buffer stream (sound stream will reload again when next gameplay starts.
'checking if the level has benn canceled by the user.
'free the level background image
Level.cancel = 0
'checking if game is completed
' IF COMMAND$(1) = "-loadlevel" THEN
' echo "Level : " + STR$(LevelStage%)
' echo "Time taken to complete : " + STR$(Level.time - Seconds%)
' END IF
'crosfading start here -
BLURIMAGE blured&, 5
_PRINTSTRING (CenterPrintX
("Stage " + STR$(LevelStage%
) + "Completed!"), 210), "Stage " + STR$(LevelStage%
) + " Completed" a$ = "Congratulations!! You created new high score!"
_PRINTSTRING (CenterPrintX
("Score - " + STR$(CurrentScore%
)), 300), "Score - " + STR$(CurrentScore%
) _PRINTSTRING (CenterPrintX
("Bonus Score - " + STR$(Seconds%
* 2)), 320), "Bonus Score - " + STR$(Seconds%
* 2) _PRINTSTRING (CenterPrintX
("Total Score - " + STR$(Seconds%
* 2 + CurrentScore%
)), 340), "Total Score - " + STR$(Seconds%
* 2 + CurrentScore%
)
IF LevelStage%
= MAX_LEVEL
THEN a$
= "Game Completed" ELSE a$
= "Be ready for next stage. Wait a moment..."
IF F
= 1 THEN SPRITESHOW ExplosionsZ
(0).img: SPRITESHOW ExplosionsZ
(1).img
SPRITENEXT ExplosionsZ(i).img
SPRITEPUT ExplosionsZ(i).x, ExplosionsZ(i).y, ExplosionsZ(i).img
F = F + 1
SPRITEHIDE ExplosionsZ(0).img
SPRITEHIDE ExplosionsZ(1).img
F = 0
SaveGame
IF LevelStage%
> MAX_LEVEL
THEN showCredits
'free the level background image
' IF COMMAND$(1) = "-loadlevel" THEN
' echo "Level failed to compete"
' END IF
'crosfading start here -
BLURIMAGE blured&, 5
'free the level background image
404
centerPrint "An Error has ocurred!", 350
centerPrint
"Error Code - " + STR$(ERR), 366 centerPrint "Error File - Main_File", 382
SUB echo
(m$
) 'always write to console
SUB showNotification
(message$
) NText$ = message$
NShow = -1
__w
= LEN(NText$
) * 8 + 40 h = 36
imgy = -40
imgy = imgy + 1
IF NFPSCount%
> 160 AND NFPSCount%
< 200 THEN imgy = imgy - 1
NFPSCount% = NFPSCount% + 1
NFPSCount% = 0
NShow = 0
W.fullscreen = 0
W.music = -1
W.sfx = -1
W.musicV = 1
W.sfxV = 1
W.SE = -1
W.fps = 90
writeConfig
'SFXs
' screen_conf:
IF Eagle&
= 0 THEN Eagle&
= _SNDOPEN("SFX/Eagle.ogg", "sync,vol,pause") IF Expos&
= 0 THEN Expos&
= _SNDOPEN("SFX/Explosion.mp3", "sync,vol,pause") IF RainSound&
= 0 THEN RainSound&
= _SNDOPEN("SFX/Rain.mp3", "vol,sync,pause")
IF Musics&
(0) = 0 THEN Musics&
(0) = _SNDOPEN("Musics/Hunter's_Revenge-Against_Evil.mp3", "sync,vol,pause") IF Musics&
(1) = 0 THEN Musics&
(1) = _SNDOPEN("Musics/Hunter's_Revenge-End_Of_Game.mp3", "sync,vol,pause") IF Musics&
(2) = 0 THEN Musics&
(2) = _SNDOPEN("Musics/Hunter's_Revenge-Who's_Next.mp3", "sync,vol,pause")
setMusicVol W.musicV
IF NOT W.music
THEN 'if menu background music disable, then stop the musics, regardless of whether the are being played or not.
W.done = -1
F = F + 1
F = 0
p = 6
FPSStart
xx = xx - 1
a = a + p
F% = F% + 1
FPSCurrent% = FPSCurrent% + 1
FPSEnd
FPSRate% = FPSCurrent%
FPSCurrent% = 0
ON TIMER(LoaderEvt!
, 0.1) ShowLoader
IF LoaderCF%
= 0 THEN LoaderCF%
= 1 _PUTIMAGE (LoaderX%
, LoaderY%
), Loader&
, 0, (LoaderCF%
* 48 - 48, 0)-(LoaderCF%
* 48 - 1, 48) LoaderCF% = LoaderCF% + 1
IF LoaderCF%
> 8 THEN LoaderCF%
= 1
' SUB PlayMovie (m$)
' LoaderStart
' DIM f AS INTEGER, n AS LONG, i AS LONG, k AS INTEGER
' f = FREEFILE
' OPEN "Movies\" + m$ + "\" + m$ + ".txt" FOR INPUT AS #f
' INPUT #f, n
' CLOSE #f
' DIM Temps_Buffers&(n)
' FOR i = 1 TO n
' Temps_Buffers&(i) = _LOADIMAGE("Movies\" + m$ + "\produce" + LTRIM$(RTRIM$(STR$(i))) + ".jpg", 33)
' NEXT
' LoaderEnd
' FOR i = 1 TO n
' FOR k = 1 TO 3
' _PUTIMAGE , Temps_Buffers&(i)
' _DISPLAY
' NEXT
' _DELAY .05
' _FREEIMAGE Temps_Buffers&(i)
' NEXT
' ERASE Temps_Buffers&
' END SUB
'Menu background music
n% = p5random(0, 2)
ON TIMER(GlobalEvent
, 0.01) GameMenu2
IF Mouse.x
> 200 AND Mouse.x
< 600 AND Mouse.y
> GameMenus
(i
).y
- 20 AND Mouse.y
< GameMenus
(i
).y
+ _FONTHEIGHT(Fonts.bigger
) THEN LINE (200, GameMenus
(i
).y
- 20)-(600, GameMenus
(i
).y
+ _FONTHEIGHT(Fonts.bigger
)), _RGBA(255, 100, 0, 100), BF
SPRITEPUT 150, GameMenus(i).y + 20, MenuBlood%
SPRITENEXT MenuBlood%
' _PRINTSTRING (GameMenus(i).x, GameMenus(i).y), RTRIM$(GameMenus(i).text)
_PUTIMAGE (200, GameMenus
(i
).y
), GameMenus
(i
).img
MenuChoice = 1
MenuChoice = 2
MenuChoice = 3
MenuChoice = 4
MenuChoice = 5
' _PRINTSTRING (GameMenus(i).x, GameMenus(i).y), RTRIM$(GameMenus(i).text)
_PUTIMAGE (200, GameMenus
(i
).y
), GameMenus
(i
).img
_PUTIMAGE (Mouse.x
- 16, Mouse.y
- 16), Mouse.cursor2
_PUTIMAGE (Mouse.x
- 16, Mouse.y
- 16), Mouse.cursor
CenterPrintX
= (_WIDTH / 2) - (a
/ 2)
GET #F
, , getCurrentLevel%
Level.completed = 0
Level.over = 0
' IF COMMAND$(1) = "-loadlevel" THEN
' GOTO skip_game_save_info
' END IF
LevelStage% = 1
HighScore% = 0
skip_game_save_info:::
' echo "loading level/stage : " + STR$(LevelStage%)
INPUT #F
, Level.background
LevelStage2% = LevelStage%
Seconds% = Level.time
OldSeconds% = Seconds%
'LevelStage% = clevel%
'Stop music during gameplay
ON TIMER(GameRenderingEvent
, 1 / W.fps
) UpdateStatus
Mouse.lclick = 0
Mouse.rclick = 0
Mouse.mclick = 0
Mouse.lclick = -1
Mouse.rclick = -1
Mouse.mclick = -1
IF W.sfx
THEN PauseSound
'Pause the sounds
BLURIMAGE bd2&, 5
CLS , 0 'make it transparent _PUTIMAGE (0, GameMenus
(i
).y
- 222), GameMenus
(i
).img2
_PUTIMAGE (150, 222), gfx&
, 0, (0, 0)-(500, p5map
(i
, 0, 255, 0, 136)) Mouse.lclick = 0
Mouse.rclick = 0
Mouse.lclick = -1
Mouse.rclick = -1
IF Mouse.x
> 150 AND Mouse.x
< 650 AND Mouse.y
> GameMenus
(i
).y
- 10 AND Mouse.y
< GameMenus
(i
).y
+ 24 THEN IF W.fullscreen
> 0 THEN W.fullscreen
= 0 ELSE W.fullscreen
= 1 W.musicV = W.musicV + .1
IF W.musicV
> 1 THEN W.musicV
= .1 W.sfxV = W.sfxV + .1
IF W.sfxV
> 1 THEN W.sfxV
= .1 Level.cancel = -1
LINE (150, GameMenus
(i
).y
- 10)-(650, GameMenus
(i
).y
+ 24), _RGBA(255, 100, 0, 100), BF
_PUTIMAGE (150, GameMenus
(i
).y
), GameMenus
(i
).img
_PRINTSTRING (630 - txtWidth
(" 10"), GameMenus
(i
).y
), " 10 " _PRINTSTRING (630 - txtWidth
(" 10"), GameMenus
(i
).y
), " 10 " _PUTIMAGE (Mouse.x
- 8, Mouse.y
- 8), Mouse.cursor
_PUTIMAGE (150, 222), gfx&
, 0, (0, 0)-(500, p5map
(i
, 0, 255, 0, 222))
loadComponents
IF W.sfx
THEN 'update the sfx volume and play the paused sound. updateSfxVolume
CloseTime
Bloods(i).active = 0
SPRITEHIDE Bloods(i).img
explosions(i).active = 0
SPRITEHIDE explosions(i).img
ShotScore(i).active = 0
' $checking:off
STATIC thunder_f_count
, thunder_ha_count
, thunder_ha_count_limit
FOR i
= 1 TO Level.enemies
IF Enemie
(i
).u
= Level.u
AND Enemie
(i
).active
= 0 AND Enemie
(i
).scene
= Level.currentScene
THEN Enemie(i).active = -1
PlayEnemieMusic i
'echo "[New Enemie] (Scene " + STR$(Level.currentScene) + ")"
'echo "Type : " + Enemie(i).typ
'echo "u : " + STR$(Enemie(i).u)
'echo "Current u : " + STR$(Enemie(i).u)
'echo " Enemie Scene : " + STR$(Enemie(i).scene)
'echo "Enemie Movement : " + STR$(Enemie(i).m)
FOR i
= 1 TO Level.enemies
IF Enemie
(i
).active
AND Enemie
(i
).scene
= Level.currentScene
THEN 'IF Enemie(i).u = Level.u THEN
' echo "Rendered"
' echo "********************************************************************************"
'END IF
IF Enemie
(i
).f
> Enemie
(i
).n
THEN SPRITENEXT Enemie
(i
).img: Enemie
(i
).f
= 0
SPRITEPUT Enemie(i).x, Enemie(i).y, Enemie(i).img
Enemie(i).x = Enemie(i).x + Enemie(i).m
Enemie(i).f = Enemie(i).f + 1
IF W.SE
THEN _SNDBAL Enemie
(i
).snd
, p5map
(Enemie
(i
).x
, 0, _WIDTH, -1, 1), p5map
(Enemie
(i
).y
, 0, _HEIGHT, 1, -1), , 2
IF Enemie
(i
).x
> _WIDTH + SPRITECURRENTWIDTH
(Enemie
(i
).img
) THEN Enemie
(i
).m
= -Enemie
(i
).m: SPRITEFLIP Enemie
(i
).img
, HORIZONTAL: PlayEnemieMusic i
IF Enemie
(i
).x
< -SPRITECURRENTWIDTH
(Enemie
(i
).img
) THEN Enemie
(i
).m
= -Enemie
(i
).m: SPRITEFLIP Enemie
(i
).img
, NONE: PlayEnemieMusic i
IF Mouse.x
> SPRITEX1
(Enemie
(i
).img
) AND Mouse.x
< SPRITEX2
(Enemie
(i
).img
) AND Mouse.y
> SPRITEY1
(Enemie
(i
).img
) AND Mouse.y
< SPRITEY2
(Enemie
(i
).img
) THEN Mouse.hovering = -1
IF Mouse.lclick
THEN Enemie
(i
).life
= Enemie
(i
).life
- Gun.damage
IF Enemie
(i
).life
< 0 THEN Enemie
(i
).life
= 0
'Showing Enemie current life with life bar
_PUTIMAGE (Enemie
(i
).x
- SPRITECURRENTWIDTH
(Enemie
(i
).img
) / 2, Enemie
(i
).y
- 30), lifeBars
(0) _PUTIMAGE (Enemie
(i
).x
- SPRITECURRENTWIDTH
(Enemie
(i
).img
) / 2, Enemie
(i
).y
- 30), lifeBars
(INT(Enemie
(i
).life
/ Enemie
(i
).life2
* 100) - 1) 'shows life bar :) 'checking if any enemie is dead :D
SPRITEHIDE Enemie(i).img
Enemie(i).ending = -1
Enemie(i).active = 0
StopEnemieMusic i
'echo "[Enemie Dead]"
'echo "Type : " + Enemie(i).typ
'echo "Enemie Scene" + STR$(Enemie(i).scene)
'echo "--------------------------------------------------------------------------------------"
'You will get more score with ShotGun :P
IF Gun.id
= 1 THEN CurrentScore%
= CurrentScore%
+ INT(Enemie
(i
).points
* 1.4)
MakeScoreFlash Enemie(i).x, Enemie(i).y, Enemie(i).points
CurrentScore% = CurrentScore% + Enemie(i).points
MakeBloods Enemie(i).x, Enemie(i).y, Enemie(i).typ
IF Gun.id
= 1 THEN Gun.id
= 2: Gun.
name = "Ak-47": Gun.damage
= 6 ELSE Gun.id
= 1: Gun.
name = "Shot Gun": Gun.damage
= 3 Mouse.rclick = 0
IF Bloods
(i
).f
> Bloods
(i
).n
THEN SPRITENEXT Bloods
(i
).img: Bloods
(i
).f
= 0: Bloods
(i
).currentFrame
= Bloods
(i
).currentFrame
+ 1 Bloods(i).f = Bloods(i).f + 1
SPRITEPUT Bloods(i).x, Bloods(i).y, Bloods(i).img
IF Bloods
(i
).currentFrame
> Bloods
(i
).totalFrames
* 2 THEN Bloods
(i
).active
= 0: SPRITEHIDE Bloods
(i
).img
IF explosions
(i
).f
> explosions
(i
).n
THEN SPRITENEXT explosions
(i
).img: explosions
(i
).f
= 0: explosions
(i
).currentFrame
= explosions
(i
).currentFrame
+ 1 explosions(i).f = explosions(i).f + 1
SPRITEPUT explosions(i).x, explosions(i).y, explosions(i).img
IF explosions
(i
).currentFrame
> explosions
(i
).totalFrames
THEN explosions
(i
).active
= 0: SPRITEHIDE explosions
(i
).img
IF Seconds%
< OldSeconds%
OR OldScore%
< CurrentScore%
THEN IF Seconds%
< 1 THEN Level.over
= -1 OldSeconds% = Seconds%
OldScore% = CurrentScore%
'redraw scoreboard
_PUTIMAGE (50, 550)-(170, 590), GunImg&
(Gun.id
- 1)
Level.u = Level.u + 1
'creating new game scene
IF SceneEnd
(Level.currentScene
) THEN Level.currentScene = Level.currentScene + 1
Level.u = 0
'echo "Current Scene : " + STR$(Level.currentScene)
IF Level.currentScene
> Level.scenes
THEN Level.completed
= -1
'game MODS
Fogs.x = Fogs.x - Fogs.move
IF Fogs.x
< -1600 OR Fogs.x
> 0 THEN Fogs.move
= -Fogs.move
FallDrops
DrawDrops
StormX% = StormX% - 1
IF StormX%
< -2300 THEN StormX%
= 0
CASE FOGMODE
+ THUNDERMODE
Fogs.x = Fogs.x - Fogs.move
IF Fogs.x
< -1600 OR Fogs.x
> 0 THEN Fogs.move
= -Fogs.move
FallDrops
DrawDrops
CASE FOGMODE
+ THUNDERMODE
+ 7 Fogs.x = Fogs.x - Fogs.move
IF Fogs.x
< -1600 OR Fogs.x
> 0 THEN Fogs.move
= -Fogs.move
FallDrops
DrawDrops
CASE STORMMODE
+ THUNDERMODE
StormX% = StormX% - 1
IF StormX%
< -2300 THEN StormX%
= 0
FallDrops
DrawDrops
CASE STORMMODE
+ FOGMODE
+ THUNDERMODE
Fogs.x = Fogs.x - Fogs.move
IF Fogs.x
< -1600 OR Fogs.x
> 0 THEN Fogs.move
= -Fogs.move
StormX% = StormX% - 1
IF StormX%
< -2300 THEN StormX%
= 0
FallDrops
DrawDrops
'scores effect
IF ShotScore
(i
).active
= -1 THEN ShotScore
(i
).sclX
= SIN(ShotScore
(i
).__ops
) * .5 + .5 _PUTIMAGE (ShotScore
(i
).x
- (ShotScore
(i
).sclX
* _WIDTH(ShotScore
(i
).img
) / 2), ShotScore
(i
).y
- (ShotScore
(i
).sclX
* _HEIGHT(ShotScore
(i
).img
)) / 2)-(ShotScore
(i
).x
+ (ShotScore
(i
).sclX
* _WIDTH(ShotScore
(i
).img
)) / 2, ShotScore
(i
).y
+ (ShotScore
(i
).sclX
* _HEIGHT(ShotScore
(i
).img
)) / 2), ShotScore
(i
).img
ShotScore(i).__ops = ShotScore(i).__ops + .1
ShotScore(i).active = 0
'countdown when game time is less or equal to 10s
'cursors
Mouse.lclick = 0
Mouse.hovering = 0
_PUTIMAGE (Mouse.x
- 16, Mouse.y
- 16), Mouse.cursor2
_PUTIMAGE (Mouse.x
- 16, Mouse.y
- 16), Mouse.cursor
IF Level.mode
= THUNDERMODE
OR Level.mode
= THUNDERMODE
+ FOGMODE
+ 7 THEN IF thunder_ha_count_limit
= 0 THEN thunder_ha_count_limit
= p5random
(1, 4) IF ThunderEvent
= 0 THEN ThunderEvent
= p5random
(30, 340) ThunderCount = ThunderCount + 1
IF ThunderCount
> ThunderEvent
THEN thunder_f_count = thunder_f_count + 1
MakeThunderImage tmp&
IF thunder_ha_count
< thunder_ha_count_limit
THEN ' ThunderCount = 0
thunder_f_count = 0
ThunderEvent = ThunderEvent + p5random(4, 25) + 3
thunder_ha_count = thunder_ha_count + 1
thunder_ha_count = 0
thunder_f_count = 0
ThunderEvent = 0
ThunderCount = 0
thunder_ha_count_limit = p5random(1, 4)
' $checking:on
CASE "jet1", "jet2", "jet3" MakeExplosions x, y
Bloods(i).active = -1
Bloods(i).x = x
Bloods(i).y = y
Bloods(i).currentFrame = 1
SPRITESHOW Bloods(i).img
SUB MakeExplosions
(x
, y
) IF explosions
(i
).active
= 0 THEN explosions(i).active = -1
explosions(i).x = x
explosions(i).y = y
explosions(i).currentFrame = 1
SPRITESHOW explosions(i).img
SUB MakeScoreFlash
(x
, y
, s
) IF ShotScore
(i
).active
= 0 THEN ShotScore(i).active = -1
ShotScore(i).x = x
ShotScore(i).y = y
ShotScore
(i
).__ops
= -_PI(.5) ShotScore(i).img = scoresImage(0)
ShotScore(i).img = scoresImage(1)
ShotScore(i).img = scoresImage(2)
ShotScore(i).img = scoresImage(3)
ShotScore(i).img = scoresImage(4)
ShotScore(i).img = scoresImage(5)
Seconds% = Seconds% - 1
Minutes%
= (Seconds%
- (Seconds%
MOD 60)) / 60
SUB PlayEnemieMusic
(which&
)
SUB StopEnemieMusic
(which&
) Enemie(which&).sndPaused = 2 '2 for stop and 1 for paused
FOR i
= 1 TO Level.enemies
FOR i
= 1 TO Level.enemies
IF Enemie
(i
).sndPaused
= 1 THEN Enemie
(i
).sndPaused
= 0:
_SNDPLAY Enemie
(i
).snd
IF Level.mode
= THUNDERMODE
OR Level.mode
= FOGMODE
+ THUNDERMODE
THEN
FOR i
= 1 TO Level.enemies
IF Enemie
(i
).sndPaused
= 0 THEN _SNDSTOP Enemie
(i
).snd: Enemie
(i
).sndPaused
= 1
FOR i
= 1 TO Level.enemies
a$ = "Save_Game\save.dat"
LevelStage% = LevelStage% + 1
IF HighScore%
< CurrentScore%
THEN PUT #F
, , CurrentScore%
ELSE PUT #F
, , HighScore%
Drop(i).yspeed = Map(Drop(i).z, 0, 1, 1, 2)
Drop
(i
).
len = Map
(Drop
(i
).z
, 0, 1, 8, 16) Drop(i).gravity = Map(Drop(i).z, 0, 1, 0.1, 0.3)
RainVol# = -1.0
Drop(i).y = Drop(i).y + Drop(i).yspeed
Drop(i).yspeed = Drop(i).yspeed + Drop(i).gravity
IF Drop
(i
).y
> _HEIGHT THEN Drop
(i
).y
= RND * -400: Drop
(i
).yspeed
= Map
(Drop
(i
).z
, 0, 1, 1, 2)
' IF RainVol# < .98 THEN RainVol# = RainVol# + 0.01: _SNDBAL RainSound&, 0, 0, RainVol#
SUB MakeThunderImage
(original_img&
)
n = p5random(30, 120)
o = buffer.OFFSET
' echo str$(o)
o = o + 4
yy = yy - 1
' SUB showCredits2 ()
' CLS
' _FONT Fonts.bigger
' _PRINTSTRING (CenterPrintX("Super Hunters 2017-18"), 250), "Super Hunters 2017-18"
' _FONT Fonts.normal
' _PRINTSTRING (CenterPrintX("By Ashish Kushwaha"), 290), "By Ashish Kushwaha"
' initTextParticles _RGB(255, 255, 255)
' CLS
' DO
' CLS
' moveTextParticles
' _LIMIT W.fps
' _DISPLAY
' LOOP UNTIL Text_Particles_Status = 1
' _DELAY 1
' fallTextParticles "fall"
' CLS
' _FONT Fonts.bigger
' _PRINTSTRING (CenterPrintX("Programmer"), 250), "Programmer"
' _FONT Fonts.normal
' _PRINTSTRING (CenterPrintX("Ashish Kushwaha"), 290), "Ashish Kushwaha"
' initTextParticles _RGB(255, 255, 255)
' ' _DISPLAY: SLEEP
' CLS
' DO
' CLS
' moveTextParticles
' _LIMIT W.fps
' _DISPLAY
' LOOP UNTIL Text_Particles_Status = 1
' _DELAY 1
' fallTextParticles "lessgravity"
' CLS
' _FONT Fonts.bigger
' _PRINTSTRING (CenterPrintX("Graphic Designer"), 250), "Graphic Designer"
' _FONT Fonts.normal
' _PRINTSTRING (CenterPrintX("Google Images & Ashish Kushwaha"), 290), "Google Images & Ashish Kushwaha"
' initTextParticles _RGB(255, 255, 255)
' CLS
' DO
' CLS
' moveTextParticles
' _LIMIT W.fps
' _DISPLAY
' LOOP UNTIL Text_Particles_Status = 1
' _DELAY 1
' fallTextParticles "explode"
' CLS
' _FONT Fonts.bigger
' _PRINTSTRING (CenterPrintX("Level Designer"), 250), "Level Designer"
' _FONT Fonts.normal
' _PRINTSTRING (CenterPrintX("Ashish Kushwaha"), 290), "Ashish Kushwaha"
' initTextParticles _RGB(255, 255, 255)
' CLS
' DO
' CLS
' moveTextParticles
' _LIMIT W.fps
' _DISPLAY
' LOOP UNTIL Text_Particles_Status = 1
' _DELAY 1
' fallTextParticles "horizontal"
' CLS
' _FONT Fonts.bigger
' _PRINTSTRING (CenterPrintX("Special Thanks -"), 230), "Special Thanks -"
' _FONT Fonts.normal
' _PRINTSTRING (CenterPrintX("Terry Ritchie for sprite library"), 270), "Terry Ritchie for sprite library"
' _PRINTSTRING (CenterPrintX("Unseenmachine & [banned user] for BlurImage"), 320), "Unseenmachine & [banned user] for BlurImage"
' _PRINTSTRING (CenterPrintX("and player of this game!"), 345), "and player of this game!"
' initTextParticles _RGB(255, 255, 255)
' CLS
' DO
' CLS
' moveTextParticles
' _LIMIT W.fps
' _DISPLAY
' LOOP UNTIL Text_Particles_Status = 1
' _DELAY 1
' fallTextParticles "boom"
' END SUB
' SUB initTextParticles (which~&)
' SHARED Text_Particles() AS Vector_Particles_Text_Type
' FOR y = 0 TO _HEIGHT - 1
' FOR x = 0 TO _WIDTH - 1
' col~& = POINT(x, y)
' IF col~& = which~& THEN n = n + 1
' NEXT x, y
' REDIM Text_Particles(n) AS Vector_Particles_Text_Type
' n = 0
' Text_Particles_Color = which~&
' FOR x = 0 TO _WIDTH - 1
' FOR y = 0 TO _HEIGHT - 1
' col~& = POINT(x, y)
' IF col~& = which~& THEN
' Text_Particles(n).x = x
' Text_Particles(n).y = y
' Text_Particles(n).vx = p5random(0, _WIDTH)
' Text_Particles(n).vy = p5random(0, _HEIGHT)
' Text_Particles(n).dist = dist(Text_Particles(n).vx, Text_Particles(n).vy, Text_Particles(n).x, Text_Particles(n).y)
' Text_Particles(n).distX = ABS(Text_Particles(n).x - Text_Particles(n).vx)
' Text_Particles(n).distY = ABS(Text_Particles(n).y - Text_Particles(n).vy)
' n = n + 1
' END IF
' NEXT y, x
' END SUB
' SUB moveTextParticles ()
' SHARED Text_Particles() AS Vector_Particles_Text_Type
' FOR i = 0 TO UBOUND(Text_Particles)
' IF Text_Particles(i).k < Text_Particles(i).dist THEN
' PSET (Text_Particles(i).vx + Text_Particles(i).delX, Text_Particles(i).vy + Text_Particles(i).delY), Text_Particles_Color
' IF Text_Particles(i).vx > Text_Particles(i).x THEN Text_Particles(i).delX = Text_Particles(i).delX - Text_Particles(i).distX / Text_Particles(i).dist ELSE Text_Particles(i).delX = Text_Particles(i).delX + Text_Particles(i).distX / Text_Particles(i).dist
' IF Text_Particles(i).vy > Text_Particles(i).y THEN Text_Particles(i).delY = Text_Particles(i).delY - Text_Particles(i).distY / Text_Particles(i).dist ELSE Text_Particles(i).delY = Text_Particles(i).delY + Text_Particles(i).distY / Text_Particles(i).dist
' Text_Particles(i).k = Text_Particles(i).k + 1
' ELSE
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' check = check + 1
' END IF
' NEXT
' IF check >= UBOUND(text_particles) THEN Text_Particles_Status = 1: EXIT SUB ELSE Text_Particles_Status = 0
' END SUB
' SUB fallTextParticles (typ$)
' SHARED Text_Particles() AS Vector_Particles_Text_Type
' typ$ = LCASE$(typ$)
' SELECT CASE typ$
' CASE "explode"
' FOR i = 0 TO UBOUND(Text_Particles)
' Text_Particles(i).vx = 0
' Text_Particles(i).vy = 0
' Text_Particles(i).delX = p5random(-0.1, 0.1)
' Text_Particles(i).delY = p5random(-0.1, 0.1)
' NEXT
' DO
' CLS
' z = 0
' FOR i = 0 TO UBOUND(Text_Particles)
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' IF i < array_len THEN
' Text_Particles(i).x = Text_Particles(i).x + Text_Particles(i).vx
' Text_Particles(i).y = Text_Particles(i).y + Text_Particles(i).vy
' Text_Particles(i).vx = Text_Particles(i).vx + Text_Particles(i).delX
' Text_Particles(i).vy = Text_Particles(i).vy + Text_Particles(i).delY
' END IF
' IF Text_Particles(i).x > _WIDTH OR Text_Particles(i).x < 0 OR Text_Particles(i).y > _HEIGHT OR Text_Particles(i).y < 0 THEN z = z + 1
' NEXT
' IF array_len < UBOUND(Text_Particles) THEN array_len = array_len + steps
' _DISPLAY
' _LIMIT W.fps
' steps = steps + 1
' IF z > UBOUND(Text_Particles) THEN EXIT DO
' LOOP UNTIL INKEY$ <> ""
' EXIT SUB
' CASE "fall"
' FOR i = 0 TO UBOUND(text_particles)
' Text_Particles(i).vx = 0
' Text_Particles(i).vy = 0
' Text_Particles(i).delX = p5random(-.02, .02)
' Text_Particles(i).delY = p5random(0.1, 0.2)
' NEXT
' DO
' CLS
' z = 0
' FOR i = 0 TO UBOUND(text_particles)
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' IF i < array_len THEN
' Text_Particles(i).x = Text_Particles(i).x + Text_Particles(i).vx
' Text_Particles(i).y = Text_Particles(i).y + Text_Particles(i).vy
' Text_Particles(i).vx = Text_Particles(i).vx + Text_Particles(i).delX
' Text_Particles(i).vy = Text_Particles(i).vy + Text_Particles(i).delY
' END IF
' IF Text_Particles(i).x > _WIDTH OR Text_Particles(i).x < 0 OR Text_Particles(i).y > _HEIGHT OR Text_Particles(i).y < 0 THEN z = z + 1
' NEXT
' IF array_len < UBOUND(text_particles) THEN array_len = array_len + steps
' _DISPLAY
' _LIMIT W.fps
' steps = steps + 1
' IF z = UBOUND(text_particles) THEN EXIT DO
' LOOP
' EXIT SUB
' CASE "lessgravity"
' FOR i = 0 TO UBOUND(Text_Particles)
' Text_Particles(i).vx = 0
' Text_Particles(i).vy = 0
' Text_Particles(i).delX = p5random(-.02, .02)
' Text_Particles(i).delY = p5random(-0.1, -0.2)
' NEXT
' DO
' CLS
' z = 0
' FOR i = 0 TO UBOUND(Text_Particles)
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' IF i < array_len THEN
' Text_Particles(i).x = Text_Particles(i).x + Text_Particles(i).vx
' Text_Particles(i).y = Text_Particles(i).y + Text_Particles(i).vy
' Text_Particles(i).vx = Text_Particles(i).vx + Text_Particles(i).delX
' Text_Particles(i).vy = Text_Particles(i).vy + Text_Particles(i).delY
' END IF
' IF Text_Particles(i).x > _WIDTH OR Text_Particles(i).x < 0 OR Text_Particles(i).y > _HEIGHT OR Text_Particles(i).y < 0 THEN z = z + 1
' NEXT
' IF array_len < UBOUND(Text_Particles) THEN array_len = array_len + steps
' _DISPLAY
' _LIMIT W.fps
' steps = steps + 1
' LOOP UNTIL INKEY$ <> "" OR z >= UBOUND(text_particles)
' EXIT SUB
' CASE "horizontal"
' FOR i = 0 TO UBOUND(Text_Particles)
' Text_Particles(i).vx = 0
' Text_Particles(i).vy = 0
' Text_Particles(i).delX = p5random(-.2, .2)
' Text_Particles(i).delY = 0
' NEXT
' DO
' CLS
' z = 0
' FOR i = 0 TO UBOUND(Text_Particles)
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' Text_Particles(i).x = Text_Particles(i).x + Text_Particles(i).vx
' Text_Particles(i).y = Text_Particles(i).y + Text_Particles(i).vy
' Text_Particles(i).vx = Text_Particles(i).vx + Text_Particles(i).delX
' Text_Particles(i).vy = Text_Particles(i).vy + Text_Particles(i).delY
' IF Text_Particles(i).x > _WIDTH OR Text_Particles(i).x < 0 OR Text_Particles(i).y > _HEIGHT OR Text_Particles(i).y < 0 THEN z = z + 1
' NEXT
' _DISPLAY
' _LIMIT W.fps
' LOOP UNTIL INKEY$ <> "" OR z >= UBOUND(text_particles)
' EXIT SUB
' CASE "vertical"
' FOR i = 0 TO UBOUND(Text_Particles)
' Text_Particles(i).vx = 0
' Text_Particles(i).vy = 0
' Text_Particles(i).delX = 0
' Text_Particles(i).delY = p5random(-0.2, 0.2)
' NEXT
' DO
' CLS
' z = 0
' FOR i = 0 TO UBOUND(Text_Particles)
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' Text_Particles(i).x = Text_Particles(i).x + Text_Particles(i).vx
' Text_Particles(i).y = Text_Particles(i).y + Text_Particles(i).vy
' Text_Particles(i).vx = Text_Particles(i).vx + Text_Particles(i).delX
' Text_Particles(i).vy = Text_Particles(i).vy + Text_Particles(i).delY
' IF Text_Particles(i).x > _WIDTH OR Text_Particles(i).x < 0 OR Text_Particles(i).y > _HEIGHT OR Text_Particles(i).y < 0 THEN z = z + 1
' NEXT
' _DISPLAY
' _LIMIT W.fps
' LOOP UNTIL INKEY$ <> "" OR z >= UBOUND(text_particles)
' EXIT SUB
' CASE "boom"
' FOR i = 0 TO UBOUND(Text_Particles)
' Text_Particles(i).vx = 0
' Text_Particles(i).vy = 0
' Text_Particles(i).delX = p5random(-.1, .1)
' Text_Particles(i).delY = p5random(-0.1, 0.1)
' NEXT
' DO
' CLS
' steps = 0
' FOR i = 0 TO UBOUND(Text_Particles)
' PSET (Text_Particles(i).x, Text_Particles(i).y), Text_Particles_Color
' Text_Particles(i).x = Text_Particles(i).x + Text_Particles(i).vx
' Text_Particles(i).y = Text_Particles(i).y + Text_Particles(i).vy
' Text_Particles(i).vx = Text_Particles(i).vx + Text_Particles(i).delX
' Text_Particles(i).vy = Text_Particles(i).vy + Text_Particles(i).delY
' IF Text_Particles(i).x > _WIDTH OR Text_Particles(i).x < 0 OR Text_Particles(i).y > _HEIGHT OR Text_Particles(i).y < 0 THEN steps = steps + 1
' NEXT
' _DISPLAY
' _LIMIT W.fps
' IF steps > UBOUND(Text_Particles) THEN EXIT DO
' LOOP UNTIL INKEY$ <> "" OR steps > UBOUND(text_particles)
' EXIT SUB
' END SELECT
' END SUB
v = v + g
txtWidth = v
'these p5random(), p5map! (original map!) and dist() functions are taken from p5js.bas
tmp! = mn!
mn! = mx!
mx! = tmp!
p5random!
= RND * (mx!
- mn!
) + mn!
dist!
= SQR((x2!
- x1!
) ^ 2 + (y2!
- y1!
) ^ 2)
FUNCTION p5map!
(value!
, minRange!
, maxRange!
, newMinRange!
, newMaxRange!
) p5map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
'By UnseenMachine & [banned user]
'http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=12658
FOR iterations%
= 0 TO Blurs
- 1
ImageOffsetStart = ImageMemory.OFFSET
ImageOffsetCurrent = ImageOffsetStart
ImageOffsetEnd
= ImageOffsetStart
+ _WIDTH(Image
) * _HEIGHT(Image
) * 4
TopOffset
= ImageOffsetCurrent
- _WIDTH(Image
) * 4 LeftOffset = ImageOffsetCurrent - 4
RightOffset = ImageOffsetCurrent + 4
BottomOffset
= ImageOffsetCurrent
+ _WIDTH(Image
) * 4
' *** Let's go ahead and set the color values to zero, and only change them when required.
Red1 = 0: Green1 = 0: Blue1 = 0: Alpha1 = 0
Red2 = 0: Green2 = 0: Blue2 = 0: Alpha2 = 0
Red3 = 0: Green3 = 0: Blue3 = 0: Alpha3 = 0
Red4 = 0: Green4 = 0: Blue4 = 0: Alpha4 = 0
' *** Get the color values from the pixel above the current pixel, if it is with the image.
IF TopOffset
>= ImageOffsetStart
THEN
' *** Get the color values from the pixel to the left of the current pixel, if it is with the image.
IF ((((LeftOffset
- ImageOffsetStart
) / 4) MOD _WIDTH(Image
)) < (((ImageOffsetCurrent
- ImageOffsetStart
) / 4) MOD _WIDTH(Image
))) THEN
' *** Get the color values from the pixel to the right of the current pixel, if it is with the image.
IF ((((RightOffset
- ImageOffsetStart
) / 4) MOD _WIDTH(Image
)) > (((ImageOffsetCurrent
- ImageOffsetStart
) / 4) MOD _WIDTH(Image
))) THEN
' *** Get the color values from the pixel below the current pixel, if it is with the image.
IF BottomOffset
< ImageOffsetEnd
THEN
' *** draw the current pixel with a newly defined _RGBA color value.
_MEMPUT ImageMemory
, ImageOffsetCurrent
, _RGBA((Red1
+ Red2
+ Red3
+ Red4
) / 4, (Green1
+ Green2
+ Green3
+ Green4
) / 4, (Blue1
+ Blue2
+ Blue3
+ Blue4
) / 4, (Alpha1
+ Alpha2
+ Alpha3
+ Alpha4
) / 4) AS _UNSIGNED LONG
'' *** These are here for fun nd testing purposes.
'_MEMPUT ImageMemory, ImageOffsetCurrent, _RGBA((Red1 + Red2 + Red3 + Red4) / 4, (Green1 + Green2 + Green3 + Green4) / 4, (Blue1 + Blue2 + Blue3 + Blue4) / 4, 255) AS _UNSIGNED LONG
'_MEMPUT ImageMemory, ImageOffsetCurrent, _RGBA(0, 0, (Blue1 + Blue2 + Blue3 + Blue4) / 4, 255) AS _UNSIGNED LONG
'_MEMPUT ImageMemory, ImageOffsetCurrent, _RGBA(0, (Green1 + Green2 + Green3 + Green4) / 4, 0, 255) AS _UNSIGNED LONG
'_MEMPUT ImageMemory, ImageOffsetCurrent, _RGBA((Red1 + Red2 + Red3 + Red4) / 4, 0, 0, 255) AS _UNSIGNED LONG
ImageOffsetCurrent = ImageOffsetCurrent + 4
LOOP UNTIL ImageOffsetCurrent
= ImageOffsetEnd
'$include:'Vendor\sprite.bi'
'End of Code ! :)