#include "sapi.au3"
#include "voiceover.au3"
#include "menu.au3"
#include "audio.au3"
#include "guiconstants.au3"
guicreate("adventure game 2.0")
guisetstate()
$credits = $device.opensound ("sounds\credits.ogg", 0)
	$ambience = iniRead ("settings.ini", "background", "background", "")
select
case $ambience = 1
$ambience = $device.opensound ("sounds\loop1.ogg", 0)
case $ambience = 2
$ambience = $device.opensound ("sounds\loop2.ogg", 0)
case $ambience = 3
$ambience = $device.opensound ("sounds\loop3.ogg", 0)
case $ambience = 4
$ambience = $device.opensound ("sounds\loop4.ogg", 0)
EndSelect
$intro = $device.opensound ("sounds\theme.wav", 0)
$dzkgames = $device.opensound ("sounds\dzkgames.ogg", 0)
$dzkgames.play
while $dzkgames.playing = 1
hotkeyset("{space}", "interupt")
WEnd
$intro.play
while $intro.playing = 1
hotkeyset("{space}", "interupt")
WEnd
$loadinggui = guicreate("loading...")
$ambience.volume = 0.5
$ambience.repeating = 1
 $ambience1 = $device.opensound ("sounds\drumbs.ogg", 0)
$ambience1.repeating = 1
$swordrange=0.5
$whiprange=0.15
$fistrange=0.35
$diff=0
$punch=$device.opensound("sounds\punch1.ogg", 0)
$punch2=$device.opensound("sounds\punch2.ogg", 0)
$gem=0
$manhp=7
$man2hp=5
$man3hp=6
$man1hp=4
$gold=0
$time=@sec
$time2=@msec
$fireball=$device.opensound("sounds\fireball.ogg", 0)
$ammo = "100"
$background = ""
$whichenemy = ""
$enemyinrange ="no"
$av=0.5
$hp = "100"
$move = "1"
$using = "1"
$nohazard=0
$levelup = "5"
$level = "1"
$beatengame = 16
$potions = "0"
$misses=0
$enemykills = "0"
$walk = $device.opensound ("step\step22.ogg", 0)
$walka=$device.opensound("step\step2.ogg",0)
$walk1 = $device.opensound ("step\step26.wav", 0)
$walk1a = $device.opensound ("step\step20.wav", 0)
$walk2 = $device.opensound ("step\step17.ogg", 0)
$walk2a=$device.opensound ("step\step19.ogg", 0)
$walk3 = $device.opensound ("step\step5.ogg", 0)
$walk3a = $device.opensound ("step\step18.ogg", 0)
$walk4 = $device.opensound ("step\step1.ogg", 0)
$walk5 = $device.opensound ("step\step30.ogg", 0)
$man3 = $device.opensound ("sounds\snake_approach.ogg", 0)
$man3attack = $device.opensound("sounds\snake_attack.ogg", 0)
$armor=0
$defaultweapon=iniRead("settings.ini","options","defaultWeapon",1)

$cheated=0
$armorsound=$device.opensound("sounds\grabarmor.ogg", 0)
$mangrunt=$device.opensound("sounds\mangrunt.ogg", 0)
opt("sendKeyDownDelay",5000)
$enemyhitsyou = $device.opensound ("sounds\enemyhitsyou.ogg", 0)
$walk6=$device.opensound("step\step25.wav", 0)
$enemyhit= $device.opensound("sounds\enemyhit.ogg", 0)
$enemyhit2= $device.opensound("sounds\enemyhit2.ogg", 0)
$draw_whip=$device.opensound("sounds\draw_whip.ogg", 0)
$draw_sword=$device.opensound("sounds\draw_sword.ogg", 0)
$autopilot=0
$draw_gun=$device.opensound("sounds\draw_gun.ogg", 0)
$whipswing = $device.opensound ("sounds\whipswing.ogg", 0)
$whiphit = $device.opensound ("sounds\whiphit.ogg", 0)
$man3die = $device.opensound ("sounds\snakedie.ogg", 0)
$hotkey=1
$amb=_soundOpen("amb\amb1.wav")
$amb2=_soundOpen("amb\amb2.wav")
$amb3=_soundOpen("amb\amb3.wav")
$amb4=_soundOpen("amb\amb4.wav")
$amb5=_soundOpen("amb\amb5.wav")
$man2 = $device.opensound ("sounds\spider_approach.ogg", 0)
$gameOver=$device.opensound ("voices\gameover.ogg", 0)
$stat=fileopen("stats.txt",1)
$man2attack = $device.opensound ("sounds\spider_attack.ogg", 0)
$man2die = $device.opensound ("sounds\spider_die.ogg", 0)
$sword = $device.opensound ("sounds\usesword.ogg", 0)
$gun = $device.opensound ("sounds\gun.ogg", 0)
$man = $device.opensound ("sounds\tiger_approach.ogg", 0)
$mandie = $device.opensound("sounds\dietiger.ogg", 0)
$manattack = $device.opensound ("sounds\tiger_attack.ogg", 0)
global $invincible=0
$strength=25
$fallleft=$device.opensound("sounds\fallleft.ogg", 0)

$man1 = $device.opensound ("sounds\skull_approach.ogg", 0)
$man1attack  = $device.opensound ("sounds\skull_attack.ogg", 0)
$man1die = $device.opensound ("sounds\skull_die.ogg", 0)
$acidwarning = $device.opensound ("sounds\acid splash.ogg", 0)
$aciddie = $device.opensound ("sounds\aspl.ogg", 0)
$dropoff = $device.opensound ("sounds\drop off.ogg", 0)
$jump = $device.opensound ("sounds\land_grass.ogg", 0)
$jumpwarning = $device.opensound ("sounds\jumpwarning.ogg", 0)
$aciddied = $device.opensound ("voices\aciddie.ogg", 0)
$beatengamevoice = $device.opensound ("voices\beatengame.ogg", 0)
$droppedoffledge = $device.opensound ("voices\droppedoffledge.ogg", 0)
$gotit = $device.opensound ("voices\gotit.ogg", 0)
	$allowBackground = iniRead ("settings.ini", "background", "amb", "")
$gunselect=$device.opensound("voices\gun.ogg", 0)
$nextlevel = $device.opensound ("voices\nextlevel.ogg", 0)
$skullnotify = $device.opensound ("voices\skull.ogg", 0)
$snakenotify = $device.opensound ("voices\snake.ogg", 0)
$spidernotify = $device.opensound ("voices\spider.ogg", 0)
$swordselect = $device.opensound ("voices\sword.ogg", 0)
$tigernotify = $device.opensound ("voices\tiger.ogg", 0)
$whipselect = $device.opensound ("voices\whip.ogg", 0)
$wrongweapon = $device.opensound ("voices\wrongweapon.ogg", 0)
$youdied = $device.opensound ("voices\youdied.ogg", 0)
$levelvoice = $device.opensound ("voices\level.ogg", 0)
$Cheatbox = $device.opensound ("voices\cheat.ogg", 0)
$count=1
$cheatinvalid = $device.opensound ("voices\cheatinvalid.ogg", 0)
$cheatactivated = $device.opensound ("voices\cheatactive.ogg", 0)
$guncheatmode = $device.opensound ("sounds\guncheatmode.ogg", 0)
$goldcoin = $device.opensound ("sounds\goldcoins.ogg", 0)
$death1=$device.opensound("sounds\die1.ogg",0)
$death2=$device.openSound("sounds\die2.ogg",0)
$goldannounce = $device.opensound ("voices\gold.ogg", 0)
$gemcoin = $device.opensound ("sounds\gem.ogg", 0)
$gemannounce = $device.opensound ("voices\gem.ogg", 0)
$gulp = $device.opensound ("sounds\gulp.ogg", 0)
$foundpotion = $device.opensound ("voices\potion.ogg", 0)
$nopotions = $device.opensound ("voices\nopotions.ogg", 0)
$dontbuypotion = $device.opensound ("voices\dontbuypotion.ogg", 0)
$endoflevel = $device.opensound ("sounds\endoflevel.ogg", 0)
$speakertest = $device.opensound ("voices\speaker test.mp3", 0)
$menuback = $device.opensound ("sounds\menu.ogg", 0)
$menuback.volume = 1
$buypotion = $device.opensound ("voices\buypotion.ogg", 0)
$boughtpotion = $device.opensound ("voices\boughtpotion.ogg", 0)
$notenoughgems = $device.opensound ("voices\notenoughgems.ogg", 0)
$notenoughgold = $device.opensound ("voices\notenoughgold.ogg", 0)
$gemsvoice = $device.opensound ("voices\gems.ogg", 0)
$healthvoice = $device.opensound ("voices\health.ogg", 0)
$potionsvoice = $device.opensound ("voices\potions.ogg", 0)
$enemykillsvoice = $device.opensound ("voices\enemykills.ogg", 0)
$muted = $device.opensound ("voices\muted.ogg", 0)
$fullvolume = $device.opensound ("voices\fullvolume.ogg", 0)
$voicegoldcoins = $device.opensound ("voices\goldcoins.ogg", 0)
$acidpit = $device.opensound ("sounds\acid pit.ogg", 0)
$acidpit.pan = 1
$acidpit.reset
$acidpit.repeating = 1
$voiceenemyinrange = $device.opensound ("voices\enemyinrange.ogg", 0)
$yes = $device.opensound ("voices\yes.ogg", 0)
$no = $device.opensound ("voices\no.ogg", 0)
$voicewhichenemy = $device.opensound ("voices\whichenemy.ogg", 0)
$emptygun = $device.opensound ("sounds\ammo-out.ogg", 0)
$loadgun = $device.opensound ("sounds\loadgun.ogg", 0)
$loadinggui = guidelete()
$acidpit.volume=0.5
menu()
func menu()
$autopilot=0
$using=$defaultweapon
$cheated=0
$nohazard=0
$menuback.volume=1
$invincible=0
	$allowBackground = iniRead ("settings.ini", "background", "amb", "")
$armor=0
_soundStop($amb)
_soundStop($amb2)
_soundStop($amb3)
_soundStop($amb4)
_soundStop($amb5)
$diff=0
$enemyinrange="no"
$whichenemy=""
$misses=0
$hp = 150
$level = 1
$move = 1
$ammo=100
$ambience.volume=$av
$levelup = 5
$acidpit.stop
$gold=0
$gem=0
$potions=0
$enemykills=0
hotkeyset("{f1}")
hotkeyset("{right}")
hotkeyset("{left}")
hotkeyset("{esc}")
hotkeyset("a")
hotkeyset("^{right}")
hotkeyset("{space}")
hotkeyset("^{left}")
hotkeyset("{down}")
hotkeyset("^p")
hotkeyset("!p")
hotkeyset("h")
hotkeyset("6")
hotkeyset(",")
hotkeyset("1")
hotkeyset("2")
hotkeyset("3")
hotkeyset("4")
hotkeyset("^c")
hotkeyset("w")
hotkeyset("r")
hotkeyset("m")
hotkeyset("c")
hotkeyset("e")
hotkeyset("l")
hotkeyset("g")
$ambience.stop
if $menuback.playing=1 then
else
$menuback.reset
$menuback.play
$menuback.repeating=1
endIf
$menu=Create_Audio_Menu("voices/mainmenu.ogg", "voices/startthegame.ogg,voices/testyourspeakersettings.ogg,voices/settings.ogg,voices/exit.ogg")
select
case $menu = 1
$menuback.volume=0.05
$menuback.repeating=1
$diff=Create_audio_menu("voices/diff.ogg","voices/easy.ogg,voices/hard.ogg")
select
case $menu=1
main()
case $menu=2
main()
endselect
case $menu = 2
$menuback.volume=0.05
$menuback.repeating=1
$speakertest.reset
$speakertest.play
sleep(700)
menu()
case $menu = 3
settings()
case $menu = 4
quit()
EndSelect
EndFunc
func settings()
falloracidpit()
$menuback.volume=0.05
$menuback.repeating=1
$menu=Create_Audio_Menu("voices/useupanddown.ogg", "voices/changebackgroundmusic.ogg,voices/backamb.ogg,voices/weapon2.wav,voices/backtoprevious.ogg")
select
case $menu = 1
$menuback.volume=0.06
$ambience.stop
$menu=Create_Audio_Menu("voices/useupanddown.ogg", "sounds/loop1.ogg,sounds/loop2.ogg,sounds/loop3.ogg,sounds/loop4.ogg")
select
case $menu = 1
  iniWrite ("settings.ini", "background", "background", "1")
$ambience = $device.opensound ("sounds\loop1.ogg", 1)
case $menu = 2
  iniWrite ("settings.ini", "background", "background", "2")
$ambience = $device.opensound ("sounds\loop2.ogg", 1)
case $menu = 3
  iniWrite ("settings.ini", "background", "background", "3")
$ambience = $device.opensound ("sounds\loop3.ogg", 1)
case $menu = 4
  iniWrite ("settings.ini", "background", "background", "4")
$ambience = $device.opensound ("sounds\loop4.ogg", 1)
EndSelect
settings()
$ambience.play
case $menu=2
$backg=create_Audio_Menu("voices/backamb2.ogg", "voices/yes.ogg,voices/no.ogg")
select
case $backg=1
iniWrite("settings.ini","background","amb",1)
if $menuback.playing=1 then
else
changelevelambience()
endIf
case $backg=2
iniWrite("settings.ini","background","amb",0)
endSelect
$allowBackground=iniRead("settings.ini","background","amb","")
settings()
case $menu=3
$defaultweapon=create_audio_menu("voices/weapon1.wav","voices/whip.ogg,voices/sword.ogg,voices/gun.ogg")
if $deFaultweapon>0 then 
iniWrite("settings.ini","options","defaultweapon",$defaultweapon)
settings()
endIf
case $menu=4
if $menuback.playing=1 then
menu()
else
main()
endIf
EndSelect
EndFunc
func main()
hotkeyset("{enter}")
hotkeyset("{down}")
hotkeyset("{up}")
hotkeyset("o","settings")
hotkeyset("{right}", "right")
$menuback.stop
if $ambience.playing=1 then
else
$ambience.reset
$ambience.play
endIf
hotkeyset("{f1}","hotkeys")
hotkeyset("{left}", "left")
hotkeyset("^{right}", "jump")
hotkeyset("^{left}","jumpLeft")
hotkeyset("4","weapon4")
hotkeyset("^{space}", "meggajump")
hotkeyset("{space}", "shoot")
hotkeyset("{space} down")
hotkeyset("{space} up","shoot")
hotkeyset("1", "weapon1")
hotkeyset("2", "weapon2")
hotkeyset("3", "weapon3")
hotkeyset("l", "levelcheck")
hotkeyset("^c", "cheat")
hotkeyset("c","checkcoord")
hotkeyset("{f5}","announcefull")
hotkeyset("h", "healthcheck")
hotkeyset("g", "gemgold")
hotkeyset("a", "ammo")
hotkeyset("p", "usepotion")
hotkeyset("^p", "potionscheck")
hotkeyset("f6", "buypotion")
hotkeyset("e", "enemyskilled")
hotkeyset("{f4}", "bgu")
hotkeyset("{f3}", "bgd")
hotkeyset("{ESC}", "writeStats")
hotkeyset("q", "quit")
hotkeyset("r", "enemyinrange")
hotkeyset("m","misses")
hotkeyset("w", "whichenemy")
hotkeyset("{enter}")
hotkeyset("+{right}","runright")
$manhp=7
$man1hp=4
$man2hp=5
$man3hp=6
while 1
changelevelambience()
wEnd
EndFunc
func quit()
 $menuback.stop
$credits.play
$ambience.stop
$ambience1.stop
while $credits.playing = 1
hotkeyset("{space}", "interupt")
WEnd
exit
EndFunc
func weapon1()
$using = 1
$draw_sword.stop
$draw_gun.stop
$draw_whip.reset
$whipselect.reset
$whipselect.play
$draw_whip.play
EndFunc
func weapon2()
$using = 2
$draw_whip.stop
$draw_gun.stop
$draw_sword.reset
$swordselect.reset
$swordselect.play
$draw_sword.play
EndFunc
func weapon3()
$using = 3
$draw_sword.stop
$draw_whip.stop
$gunselect.reset
$gunselect.play
if $ammo>0 then
$draw_gun.reset
$draw_gun.play
endIf
EndFunc
func jump()
hotkeyset("^{right}")
$move = $move+2
$acidpit.pan = $acidpit.pan-0.4
acidcontrol()
$jump.reset
$jump.play
SLEEP(400)
obsticles()
walksounds()
hotkeyset("^{right}", "jump")
randomhappenings()
EndFunc
func meggajump()
hotkeyset("^{space}")
$move = $move+5
$hp = $hp-10
$acidpit.pan = $acidpit.pan-0.9
acidcontrol()
$jump.reset
$jump.play
SLEEP(400)
obsticles()
walksounds()
hotkeyset("^{right}", "jump")
randomhappenings()
EndFunc
Func left ()
if $move<=1 then
$move=1
else
$move = $move-1
hotkeyset("{left}")
obsticles()
Randomhappenings()
$acidpit.pan = $acidpit.pan+0.2
acidcontrol()
walkSounds()
hotkeyset("{left}", "left")
endIf
EndFunc
Func right ()
$move = $move+1
hotkeyset("{right}")
$acidpit.pan = $acidpit.pan-0.2
obsticles()
Randomhappenings()
walkSounds()
sleep(5)
acidcontrol()
hotkeyset("{right}", "right")
EndFunc
func randomhappenings()
if $diff=2 then $diffDev=4
if $diff=1 then $diffdev=1
$random = random (1, 20, 1)
select
case $random = 1
hotkeyset("^{right}")
$snakeNotify.reset
$snakenotify.play
sleep(1000/$diffDev)
snakeattack()
case $random = 2
hotkeyset("^{right}")
$spidernotify.reset
$spidernotify.play
sleep(1000/$diffDev)
spiderattack()
case $random = 3
hotkeyset("^{right}")
$tigerNotify.reset
$tigerNotify.play
sleep(1000/$diffDev)
tigerattack()
case $random = 4
hotkeyset("^{right}")
$skullnotify.reset
$skullnotify.play
sleep(1000/$diffDev)
skullattack()
case $random = 5
$goldannounce.reset
$goldannounce.play
$goldcoin.reset
$goldcoin.play
$gold = $gold+2
case $random = 6
$gemannounce.reset
$gemannounce.play
$gemcoin.reset
$gemcoin.play
$gem= $gem+1
case $random = 7
if $potions>5 then
else
$foundpotion.reset
$foundpotion.play
$potions = $potions+1
endIf
case $random = 8
$loadgun.reset
$loadgun.play
$ammo = $ammo+2
case $random=9
$armor=$armor+2
if $armor>10 then
if $armor>=50 then
$armor=50
else
$armor=10
endIf
else
speak("armadura",1)
speak($armor,1)
$armorsound.play
endIf
EndSelect
while $autopilot=1
detect()
wend
EndFunc
func snakeattack()
$whichenemy = "man3"
$man3.reset
$man3.play
$man3.repeating = 1
$man3.pan = 1
while 1
sleep(300/$diff)
randomsnakemove()
WEnd
EndFunc
 Func randomsnakemove()
$man3.pan = $man3.pan-0.2
enemywalksounds($man3)
if $using=1 then
if $whiprange>=$man3.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endif
elseIf $using = 2 then
if $swordrange>=$man3.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endIf
elseIf $using=4 or $using=3 then
$enemyinrange = "yes"
elseIf $using=5 then
if $fistrange>=$man3.pan then
$enemyinrange="yes"
else
$enemyinrange="no"
endIf
else
$enemyinrange="no"
endIf
checkbite()
  EndFunc
func spiderattack()
$enemyinrange = "no"
$whichenemy = "man2"
$man2.reset
$man2.play
$man2.repeating = 1
$man2.pan = 1
while 1
sleep(300/$diff)
randomspidermove()
WEnd
EndFunc
 Func randomspidermove()
if $using=1 then
if $whiprange>=$man2.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endif
elseIf $using = 2 then
if $swordrange>=$man2.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endIf
elseIf $using=4 or $using=3 then
$enemyinrange = "yes"
elseIf $using=5 then
if $fistrange>=$man2.pan then
$enemyinrange="yes"
else
$enemyinrange="no"
endIf
else
$enemyinrange="no"
endIf
$man2.pan = $man2.pan-0.2
enemywalksounds($man2)
checkbite()
 EndFunc
func tigerattack()
$whichenemy = "man"
$man.reset
$man.play
$man.repeating = 1
$man.pan = 1
while 1
sleep(200/$diff)
randomtigermove()
WEnd
EndFunc
Func randomtigermove()
if $using= 1 then
if $whiprange>=$man.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endif
elseIf $using = 2 then
if $swordrange>=$man.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endIf
elseIf $using=3 or $using=4 then
$enemyinrange = "yes"
elseIf $using=5 then
if $fistrange>=$man.pan then
$enemyinrange="yes"
else
$enemyinrange="no"
endIf
endIf
$man.pan = $man.pan-0.125
enemyWalkSounds($man)
checkbite()
 EndFunc
func skullattack()
$whichenemy = "man1"
$man1.reset
$man1.pan = 1
$man1.play
$man1.repeating = 1
while 1
sleep(375/$diff)
randomskullmove()
WEnd
EndFunc
Func randomskullmove()
if $using= 1 then
if $whiprange>=$man1.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endif
elseIf $using = 2 then
if $swordrange>=$man1.pan then
$enemyinrange = "yes"
else
$enemyinrange = "no"
endIf
elseIf $using=4 or $using=3 then
$enemyinrange = "yes"
elseIf $using=5 then
if $fistrange>=$man1.pan then
$enemyinrange="yes"
else
$enemyinrange="no"
endIf
endIf
$man1.pan = $man1.pan-0.075
enemyWalkSounds($man1)
checkbite()
EndFunc
func checkhp()
select
case $hp <= 0
hotkeyset("{space}")
hotkeyset("{left}")
hotkeyset("{right}")
$random2 = random(1,2,1)
select
case $random2==1
$youdied.reset
$youdied.play
case $random2==2
$gameover.reset
$gameover.play
endSelect
while $youdied.playing = 1
sleep(1)
WEnd
while $gameover.playing= 1
sleep(1)
wEnd
$ambience.stop
$ambience1.stop
$man1.stop
$man.stop
$man2.stop
$man3.stop
$acidpit.stop
writeStats()
menu()
case $hp <= 25
$ambience.volume=0.1
$ambience1.play
case $hp>25
if $Hp>150 then
$hp=150
endIf
$ambience1.stop
$ambience.volume=$av
EndSelect
EndFunc
func falloracidpit()
if $nohazard==1 or $invincible=1 then
else
hotkeyset("s")
hotkeyset("{f1}")
hotkeyset("{left}")
hotkeyset("{right}")
hotkeyset("a")
hotkeyset("^{right}")
hotkeyset("^{left}")
hotkeyset("{space}")
hotkeyset("{down}")
hotkeyset("^p")
hotkeyset("!p")
hotkeyset("h")
hotkeyset("6")
hotkeyset(",")
hotkeyset("1")
hotkeyset("2")
hotkeyset("3")
hotkeyset("4")
hotkeyset("^c")
hotkeyset("w")
hotkeyset("r")
hotkeyset("m")
hotkeyset("c")
hotkeyset("e")
hotkeyset("l")
hotkeyset("g")
endIf
endFunc
func soundstopobstacle()
if $invincible==1 or $nohazard==1 then
else
sleep(4000)
$ambience.stop
$ambience1.stop
 $man.stop
$man2.stop
$man3.stop
$acidpit.stop
writestats()
endIf
endFunc
func obsticles()
levelch()
select
case $move = 5
$jumpwarning.reset
$jumpwarning.play
 case $move = 6
falloracidpit()
$dropoff.play
$droppedoffledge.reset
$droppedoffledge.play
soundstopobstacle()
case $move = 7
$gotit.reset
$gotit.play
case $move = 10
$acidpit.play
$acidpit.pan = 1.2
case $move = 14
$acidwarning.reset
$acidwarning.play
case $move = 15
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $move = 16
$gotit.reset
$gotit.play
case $move = 25
$jumpwarning.reset
 $jumpwarning.play
case $move = 26
falloracidpit()
$dropoff.play
 $droppedoffledge.reset
$droppedoffledge.play
soundstopobstacle()
case $move = 27
$gotit.play
case $move = 47
$jumpwarning.reset
 $jumpwarning.play
case $move = 48
falloracidpit()
$dropoff.play
 $droppedoffledge.reset
$droppedoffledge.play
soundstopobstacle()
case $move = 49
$gotit.play
case $move = 54
$acidpit.pan = 1.2
$acidpit.play
case $move = 58
$acidwarning.reset
$acidwarning.play
case $move = 59
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $move = 60
$gotit.reset
$gotit.play
case $move = 71
$jumpwarning.reset
$jumpwarning.play
case $move = 72
falloracidpit()
$dropoff.play
 $droppedoffledge.reset
$droppedoffledge.play
soundstopobstacle()
case $move = 73
$gotit.play
case $move = 74
$acidpit.play
$acidpit.pan = 1.2
case $move = 78
$acidwarning.play
case $move = 79
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $move = 87
$acidpit.play
$acidpit.pan = 1.2
case $move = 89
$jumpwarning.reset
$jumpwarning.play
case $move = 90
falloracidpit()
$dropoff.play
$droppedoffledge.play
soundstopobstacle()
case $move = 91
$gotit.reset
$gotit.play
$acidwarning.play
case $move = 92
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $move = 93
$gotit.reset
$gotit.play
case $move=96
$jumpwarning.reset
$jumpwarning.play
case $move=97
falloracidpit()
$dropoff.play
$droppedoffledge.play
soundstopobstacle()
case $move=98
$gotit.reset
$gotit.play
$acidpit.play
$acidpit.pan=1
case $move = 101
$acidwarning.play
case $move=102
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $Move=103
$gotit.play
case $move = 106
$jumpwarning.play
case $move = 107
falloracidpit()
$dropoff.play
$droppedoffledge.play
soundstopobstacle()
case $move = 108
$gotit.play
case $move = 113
$acidpit.play
$acidpit.pan = 1.2
case $move = 117
$acidwarning.play
case $move = 118
falloracidpit()
$aciddied.play
soundstopobstacle()
case $move=119
$gotit.play
case $move = 121
$acidpit.play
$acidpit.pan = 1.2
case $move = 125
$acidwarning.play
case $move = 126
falloracidpit()
$aciddied.play
soundstopobstacle()
case $move = 127
$gotit.play
case $move = 141
$jumpwarning.play
case $move = 142
falloracidpit()
$dropoff.play
$droppedoffledge.play
soundstopobstacle()
case $move = 143
$gotit.play
case $move= 153
$acidpit.play
$acidpit.pan = 1.2
case $move = 158
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $move = 159
$gotit.reset
$gotit.play
case $move = 179
$jumpwarning.play
case $move = 180
falloracidpit()
$dropoff.play
$droppedoffledge.reset
$droppedoffledge.play
soundstopobstacle()
case $move = 181
$gotit.play
case $move = 194
$acidpit.play
$acidpit.pan = 1.2
case $move = 199
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
case $move = 207
$jumpwarning.play
case $move = 208
falloracidpit()
$dropoff.play
$droppedoffledge.play
soundstopobstacle()
case $move = 209
$gotit.play
case $move = 220
$acidpit.play
$acidpit.pan = 1.2
case $move = 225
falloracidpit()
$aciddie.play
$aciddied.play
soundstopobstacle()
EndSelect
EndFunc
func interupt()
$dzkgames.stop
$intro.stop
$credits.stop
EndFunc
func levelcheck()
$levelvoice.play
while $levelvoice.playing = 1
sleep(1)
WEnd
vo($level)
EndFunc
Func cheat()
hotkeyset("{esc}")
hotkeyset("{enter}")
hotkeyset("a")
hotkeyset("{space}")
hotkeyset("{enter}")
hotkeyset("{left}")
hotkeyset("{right}")
hotkeyset("c")
hotkeyset("l")
hotkeyset("h")
hotkeyset("g")
hotkeyset("e")
hotkeyset("m")
hotkeyset("p")
hotkeyset("r")
hotkeyset("w")
hotkeyset("1")
hotkeyset("2")
hotkeyset("3")
hotkeyset("4")
hotkeyset("o")
$random=random(5,35,1)
$random2=random(10,150,1)
$cheatbox.reset
$cheatbox.play
$cheat = inputbox ("entra el truco", "entra tu truco y pulsa enter cuando lo hayas terminado!")
select
case $cheat="automático"
startAP()
menu()
case $cheat = "dame salud"
$hp = 100
checkhp()
$cheated=$cheated+1
$cheatactivated.play
Main()
case $cheat = "quiero completar el juego"
$cheatactivated.play
$level=$beatengame
$cheated=$cheated+1
obsticles()
case $cheat = "dame el arma de poder"
$using = 4
$cheatactivated.play
$cheated=$cheated+1
hotkeyset("5","powerweapon")
main()
case $cheat = "quiero muchas gemas"
$gem=$gem+$random
vo($random)
$cheated=$cheated+1
main()
case $cheat = "quiero mucho oro"
$gold = $gold+$random2
 vo($random2)
$cheated=$cheated+1
main()
case $cheat="siguiente nivel"
$move=$levelup
randomhappenings()
obsticles()
$acidpit.stop
$cheated=$cheated+1
main()
changelevelambience()
case $cheat="quiero pociones"
$random3=random(4,12,1)
$potions=$potions+$random3
vo($random3)
$cheated=$cheated+1
main()
case $cheat="soy invencible"
$invincible=1
$armor=50
speak("ahora eres invencible!")
$cheated=$cheated+1
main()
case $cheat="que los peligros no me maten"
speak("si señor",2)
global $nohazard=1
$cheated=$cheated+1
main()
case $cheat="que los enemigos no me hagan daño"
speak("si así  lo quieres entonces")
$armorsound.play
$armor=25
$cheated=$cheated+1
main()
case else
$cheatinvalid.play
$cheated=$cheated+1
main()
EndSelect
EndFunc
func healthcheck()
$healthvoice.reset
$healthvoice.play
while $healthvoice.playing = 1
sleep(1)
WEnd
vo($hp)
speak("armadura")
vo($armor)
EndFunc
func gemgold()
$gemsvoice.reset
$gemsvoice.play
while $gemsvoice.playing = 1
sleep(1)
WEnd
vo($gem)
$voicegoldcoins.reset
$voicegoldcoins.play
while $voicegoldcoins.playing = 1
sleep(1)
WEnd
vo($gold)
EndFunc
func usepotion()
if $hp>=100 then
else
select
case $potions > 0
$gulp.reset
$gulp.play
$hp = $hp+25
$potions = $potions-1
if $hp>100 then $hp=100
checkhp()
case else
$nopotions.reset
$nopotions.play
EndSelect
endIf
EndFunc
func potionscheck()
$potionsvoice.reset
$potionsvoice.play
while $potionsvoice.playing = 1
sleep(1)
WEnd
vo($potions)
EndFunc
func buypotion()
hotkeyset("{enter}")
hotkeyset("{left}")
hotkeyset("{right}")
$buypotion.play
$potbuy = inputbox("buy potion", "enter y if you want to buy one, or n if you don't!")
if $potbuy = "y" then
if $gold < 4 then
$notenoughgold.reset
$notenoughgold.play
while $notenoughgold.playing = 1
sleep(1)
WEnd
Main()
EndIf
If $gem < 4 then
$notenoughgems.reset
$notenoughgems.play
while $notenoughgems.playing = 1
sleep(1)
WEnd
main()
EndIf
$gold = $gold-4
$gem = $gem-4
$boughtpotion.play
$potions = $potions+1
main()
Else
$dontbuypotion.play
main()
EndIf
EndFunc
func enemyskilled()
$enemykillsvoice.reset
$enemykillsvoice.play
while $enemykillsvoice.playing = 1
sleep(1)
WEnd
vo($enemykills)
EndFunc
func bgu()
$ambience.volume = $ambience.volume+0.05
select
case $ambience.volume > 1.0
$fullvolume.reset
$fullvolume.play
$ambience.volume = 1.0
EndSelect
$av=$ambience.volume
EndFunc
func bgd()
$ambience.volume = $ambience.volume-0.05
select
case $ambience.volume < 0.0
$muted.reset
$muted.play
$ambience.volume = 0.0
EndSelect
$av=$ambience.volume
EndFunc
 func acidcontrol()
select
case $acidpit.pan < -1
$acidpit.pan = -1
$acidpit.volume = $acidpit.volume-0.1
acidvolume()
EndSelect
endfunc
Func Acidvolume()
select
case $acidpit.volume  < 0
$acidpit.pan = 0
$acidpit.stop
EndSelect
EndFunc
func shoot()
select
case $using = 1
$whiphit.reset
$whiphit.play
hotkeyset("{space}")
send("{space up}")
sleep(100)
hotkeyset("{space}","shoot")
case $using = 2
$sword.reset
$sword.play
case $using = 3
select
case $ammo > 0
$ammo = $ammo-1
$gun.reset
$gun.play
case else
$emptygun.reset
$emptygun.play
$misses=$misses+1
return
EndSelect
case $using=5
punch()
case else
$guncheatmode.reset
$guncheatmode.play
EndSelect
Select
case $enemyinrange = "yes"
select
case $using=5
case else
$enemykills = $enemykills+1
$whichenemy = ""
$enemyinrange = "no"
$random=random(1,6,1)
select
case $random=1
$mandie.reset
$mandie.play
case $random=2
$man1die.reset
$man1die.play
case $random=3
$man2die.reset
$man2die.play
case $random=4
$man3die.reset
$man3die.play
case $random=5
$death1.reset
$death1.play
case $random=6
$death2.reset
$death2.play
endselect
$man.stop
$man1.stop
$man2.stop
$man3.stop
$MAN3.PAN=1
$MAN2.PAN=1
$MAN1.PAN=1
$MAN.PAN=1
$walk.reset
$walka.reset
$walk2.reset
$walk2a.reset
$walk1.reset
$walk1a.reset
main()
endSelect
case else
select
case $using=5
case else
$misses=$misses+1
endSelect
EndSelect
EndFunc
Func enemyinrange()
select
case $enemyinrange = "no"
$no.reset
$no.play
case else
$yes.reset
$yes.play
EndSelect
EndFunc
func checkbite()
select
case $man.pan < 0
$manattack.reset
$manattack.play
$random3=random(1,3,1)
select
case $random3==1
$enemyhitsyou.play
case $random3==2
$enemyhit.play
case $random3==3
$enemyhit2.play
endSelect
$hp = $hp-(($diff*16)-$armor)
checkhp()
case $man1.pan < 0
$man1attack.reset
$man1attack.play
$random3=random(1,3,1)
select
case $random3==1
$enemyhitsyou.reset
$enemyhitsyou.play
case $random3==2
$enemyhit.reset
$enemyhit.play
case $random3==3
$enemyhit2.reset
$enemyhit2.play
endSelect
$hp = $hp-(($diff*10)-$armor)
checkhp()
case $man3.pan < 0
 $man3attack.play
$random3=random(1,3,1)
select
case $random3==1
$enemyhitsyou.reset
$enemyhitsyou.play
case $random3==2
$enemyhit.reset
$enemyhit.play
case $random3==3
$enemyhit2.reset
$enemyhit2.play
endSelect
$hp = $hp-(($diff*13)-$armor)
checkhp()
case $man2.pan < 0
$man2attack.play
$random3=random(1,3,1)
select
case $random3==1
$enemyhitsyou.reset
$enemyhitsyou.play
case $random3==2
$enemyhit.reset
$enemyhit.play
case $random3==3
$enemyhit2.reset
$enemyhit2.play
endSelect
$hp = $hp-(($diff*9)-$armor)
checkhp()
EndSelect
EndFunc
Func whichenemy()
speak($whichenemy,2+1)
EndFunc
func misses()
vo($misses)
endFunc
func checkCoord()
vo($move)
endFunc
func ammo()
vo($ammo)
endFunc
func changelevelambience()
if $allowBackground=1 then
select
case $level=1
_soundPlay($amb)
case $level = 2
_soundStop($amb)
_soundPlay($amb2)
case $level = 3
_soundSTop($amb2)
_soundPlay($amb3)
case $level=4
_soundStop($amb3)
_soundPlay($amb4)
case $level=5
_soundStop($amb4)
_soundPlay($amb5)
case $level=6
_soundStop($amb5)
endSelect
else
endIf
endFUnc
func jumpLeft()
hotkeyset("^{left}")
select
case $move <= 2
$fallleft.play
$fallleft.pan=-0.4
sleep(100)
$fallleft.pan=-0.6
falloracidpit()
sleep(100)
$fallleft.pan=-0.8
sleep(100)
$fallleft.pan=-1
while $fallleft.playing=1
sleep(1)
wend
menu()
case else
$move = $move-2
$acidpit.pan = $acidpit.pan+0.4
acidcontrol()
obsticles()
$jump.reset
$jump.play
hotkeyset("^{left}", "jumpLeft")
randomhappenings()
case else
endSelect
EndFunc
func hotkeys()
$hotkey=1
hotkeyseT("{DOWN}","NEXTHOTKEY")
HOTKEYSET("{up}","prevhotkey")
HOTKEYSET("{escape}","main")
hotkeyset("{right}")
hotkeyset("{left}")
hotkeyset("{space}")
hotkeyset("^{right}")
hotkeyset("^{left}")
hotkeyset("{f1}")
SPEAK("USA FLECHA ARRIBA Y ABAJO PARA NAVEGAR POR LA LISTA DE TECLAS Y DE AHÍ PULSA ESCAPE PARA SALIR.",0)
sayhotkey()
endFunc
func prevhotkey()
if $hotkey <= 1 then
sayhotkey()
else
$Hotkey=$hotkey-1
sayhotkey()
endIf
endFunc
func nexthotkey()
$Hotkey=$hotkey + 1
sayhotkey()
endFunc
func sayhotkey()
select
case $hotkey=1
speak("para moverse a la derecha es con la flecha derecha", 2+1)
case $hotkey=2
speak("para moverse a la izquierda es con la  flecha iszquierda", 2+1)
case $hotkey=3
speak("para saltar a la derecha presiona control flecha derecha",2+1)
case $hotkey=4
speak("para saltar a la izquierda presiona control flecha izquierda",2+1)
case $hotkey=5
speak("para usar el arma que selecciones usa espacio",2+1)
case $hotkey=6
speak("para volver al menú principal usa la coma",2+1)
case $hotkey=7
speak("para cambiar de armas es pulsando del 1 al 4", 2+1)
case $Hotkey=8
speak("para checar tu salud se pulsa la h",2+1)
case $hotkey=9
speak("y para tu nivel la l",2+1)
case $Hotkey=10
speak("para ver la cantidad de oro y gemas con la g",2+1)
case $Hotkey=11
speak("para ver cuantas veces te as perdido presiona m",2+1)
case $Hotkey=12
speak("para ver asesinatos pulsa la e",2+1)
case $hotkey=13
speak("para ver si el enemigo está al alcanze de tu arma presiona la r",2+1)
endselect
endfunc
func weapon4()
$using=5
speak("puños", 2+1)
endFunc

func punch()
$random=random(1,2,1)
select
case $random=1
$punch.reset
$punch.play
case $random=2
$punch2.reset
$punch2.play
endSelect
if $enemyinrange="yes" then
$manhp=$Manhp-1
$mangrunt.reset
$mangrunt.play
if $manhp=0 then
$random=random(1,6,1)
select
case $random=1
$mandie.reset
$mandie.play
case $random=2
$man1die.reset
$man1die.play
case $random=3
$man2die.reset
$man2die.play
case $random=4
$man3die.reset
$man3die.play
case $random=5
$death1.reset
$death1.play
case $random=6
$death2.reset
$death2.play
endselect
$man.stop
$man1.stop
$man2.stop
$man3.stop
$MAN3.PAN=1
$MAN2.PAN=1
$MAN1.PAN=1
$MAN.PAN=1
$whichenemy=""
$enemyinrange=""
main()
endIf
else
$misses=$misses+1
endIf
endFunc
func powerweapon()
$using=4
speak("bombas", 2+1)
endFunc
func announcefull()
healthcheck()
potionscheck()
gemgold()
enemyskilled()
levelcheck()
speak("errores")
misses()
speak("munición en tu pistola")
ammo()
endfunc
func runright()
$move=$move+1
hotkeyset("+{right}")
obsticles()
randomhappenings()
$acidpit.pan=$acidpit.pan-0.2
acidControl()
select
case $level = 1
$random=random(1,2,1)
select
case $random=1
$walk.reset
$walk.pitchshift=1.5
$walk.play
case $random=2
$walka.reset
$walka.pitchshift=1.5
$walka.play
endselect
while $walk.playing = 1 or $walka.playing=1
sleep(1)
WEnd
case $level = 2
$random=random(1,2,1)
select
case $random=1
$walk1.reset
$walk1.pitchshift=1.75
$walk1.play
case $random=2
$walk1a.reset
$walk1a.pitchshift=1.75
$walk1a.play
endSelect
while $walk1.playing = 1 or $walk1a.playing=1
sleep(1)
WEnd
case $level = 3
$random=random(1,2,1)
select
case $random=1
$walk2.reset
$walk2.play
case $random=2
$walk2a.reset
$walk2a.play
endSelect
while $walk2.playing = 1 or $walk2a.playing=1
sleep(1)
wend
case $level = 4
$random=random(1,2,1)
select
case $random=1
$walk3.reset
$walk3.play
case $random=2
$walk3a.reset
$walk3a.play
endselect
while $walk3.playing = 1 or $walk3a.playing=1
sleep(1)
WEnd
case $level = 5
$walk4.reset
$walk4.play
while $walk4.playing = 1
sleep(1)
WEnd
case $level = 6
$walk5.reset
$walk5.play
while $walk5.playing = 1
sleep(1)
WEnd
EndSelect
hotkeyset("+{right}","runright")
$walk.pitchshift=1
$walka.pitchshift=1
$walk1.pitchshift=1
$walk1a.pitchshift=1
endFunc
func levelch()
select
case $move = $levelup
$level = $level+1()
$nextlevel.play
$endoflevel.play
$levelup = $levelup+(2+(2*$level))
case  $level >= $beatengame
falloracidpit()
$beatengamevoice.reset
$beatengamevoice.play
sleep(4000)
$acidpit.stop
$gemsvoice.reset
$gemsvoice.play
sleep(175)
vo($gem)
$ambience.stop
sleep(250)
$ambience1.stop
 $man.stop
$man1.stop
$man2.stop
$man3.stop
$voicegoldcoins.play
while $voicegoldcoins.playing = 1
sleep(1)
WEnd
vo($gold)
$enemykillsvoice.reset
$enemykillsvoice.play
while $enemykillsvoice.playing=1
sleep(1)
wend
vo($enemykills)
writestats()
endSelect
endFunc
func writeStats()
speak("estadísticas escritas.",2+1)
fileWriteLIne($stat,"game played on "&@mon&"/"&@mday&"/"&@year&", at "&@hour&":"&@min)
if $cheated>=1 then
fileWriteLine($stat,"as usado "&$cheated&" trucos en el juego.")
else
if $level=$beatengame then
fileWriteLine($stat,"Whoa! usted no a usado ningún truco del juego")
endif
endIf
fileWriteLIne($stat,"has matado "&$enemykills&" enemigos.")
if $misses=1 then
fileWriteLine($stat,"usted se perdió una ves!")
elseIf $misses=0 then
fileWriteLIne($stat,"Wow! nunca se perdió en este juego")
else
fileWriteLIne($stat,"te has perdido "&$misses&" veces.")
endIf
fileWriteLIne($stat,"usted  tuvo "&$potions&" pociones.")
fileWriteLIne($stat,"encontraste"&$gem&" gemas y "&$gold&" monedas de oro !")
if $level<$beatengame then
fileWriteLine($stat,"has finalisado en el nivel "&$level&".")
else
fileWriteLIne($stat,"whoa! ganaste!")
endIf
fileWriteLine($stat,"as finalisado el juego con "&$hp&" de salud y "&$ARMOR&" de armadura.")
if $Hp<=0 then
fileWriteLIne($stat,"Awww, eso estuvo mal, moriste")
endIf
menu()
endFunc
func walksounds()
select
case $level = 1
$random=random(1,2,1)
$walk.reset
$walka.reset
select
case $random=1
$walk.play
case $random=2
$walka.play
endselect
while $walk.playing = 1 or $walka.playing=1
sleep(1)
WEnd
case $level = 2
$random=random(1,2,1)
$walk1.reset
$walk1a.reset
select
case $random=1
$walk1.play
case $random=2
$walk1a.play
endSelect
while $walk1.playing = 1 or $walk1a.playing=1
sleep(1)
WEnd
case $level = 3
$walk2.reset
$walk2a.reset
$walk2.play
while $walk2.playing = 1
sleep(1)
wend
case $level = 4
$random=random(1,2,1)
$walk3.reset
$walk3a.reset
select
case $random=1
$walk3.play
case $random=2
$walk3a.play
endselect
while $walk3.playing = 1 or $walk3a.playing=1
sleep(50)
WEnd
case $level = 5
$walk4.reset
$walk4.play
while $walk4.playing = 1
sleep(100)
WEnd
case $level = 6
$walk5.reset
$walk5.play
while $walk5.playing = 1
sleep(50)
WEnd
case $level=7
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=8
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=9
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=10
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=11
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=12
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=13
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=14
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
case $level=15
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
EndSelect
endFunc
func startAP()
$using=4
$autopilot=1
while $autopilot=1
right()
sleep(1)
detect()
wend
endFUnc
func detect()
select
case $jumpwarning.playing=1 or $acidWarning.playing=1
jump()
endSelect
select
case $man.playing=1
msgbox(1,"debug","man está jugando")
shoot()
right()
case $man1.playing=1
msgbox(1,"debug","man1 está jugando")
shoot()
right()
case $man2.playing=1
msgbox(1,"debug","man2 está jugando")
shoot()
right()
case $Man3.playing=1
msgbox(1,"debug","man3 está jugando ")
shoot()
right()
endSelect
endFunc
FUNC ENEMYWALKSOUNDS($ENEMY)
select
case $level = 1
$random=random(1,2,1)
$walk.reset
$walka.reset
select
case $random=1
$walk.play
case $random=2
$walka.play
endselect
case $level = 2
$random=random(1,2,1)
$walk1.reset
$walk1a.reset
select
case $random=1
$walk1.play
case $random=2
$walk1a.play
endSelect
case $level = 3
$walk2.reset
$walk2a.reset
$walk2.play
case $level = 4
$random=random(1,2,1)
$walk3.reset
$walk3a.reset
select
case $random=1
$walk3.play
case $random=2
$walk3a.play
endselect
while $walk3.playing = 1 or $walk3a.playing=1
sleep(50)
WEnd
case $level = 5
$walk4.reset
$walk4.play
while $walk4.playing = 1
sleep(100)
WEnd
case $level = 6
$walk5.reset
$walk5.play
while $walk5.playing = 1
sleep(50)
WEnd
case $level=7
$walk6.reset
$walk6.play
while $walk6.playing=1
sleep(1)
wend
EndSelect
$walk.pan=$enemy.pan
$walka.pan=$enemy.pan
$walk1.pan=$enemy.pan
$walk1a.pan=$enemy.pan
endFunc