**UPDATED**I tried making it so that you can hold the key down and the ship keeps moving, but all results caused major lag in the game, so I took it out.
Also, you can choose which path to install it to with the new installer. I've also added an uninstall feature for quick removal.
I just finished my E-nvaderz game. I made all graphics with Photoshop and all sound effects were made by me. The graphics are a little choppy and the sounds get cut off, but I think it turned out quite good. It has a bunch of images and sounds, so you'll have to download the installer
here.
Screenshots:
Here's the source code:
Code:
;Creator: Eedis
;Email: Killerbender53@yahoo.com
SetBatchLines, -1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Set Values for various things;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Ship_Speed=15
Ship_X=240
Ship_Y=450
Ship_Lives=3
BullSpeed=15
Dir=1
EnShip_DropSpeed=10
EnShip_Speed=4
EnBullCount=0
EnShipHp=1
Logo=%A_ScriptDir%\Images\logo.bmp
SoundPath=%A_ScriptDir%\Sounds
FilePath=%A_ScriptDir%\Images
Bullet=%A_ScriptDir%\Images\bullet3.bmp
Ship=%A_ScriptDir%\Images\ship2.bmp
BonShip=%A_ScriptDir%\Images\bonship.bmp
CanBull=1
Kills=0
theme=1
Level=1
xx=100
Started=0
ShotsFired=0
Pause=0
BonShipKills=0
Score=0
ScoreTNL=250
Index=0
StartTime:=A_TickCount
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Build the GUI and Tray Menu;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Menu, Tray, NoStandard
Menu, Tray, Add, F2: Pause, Pause
Menu, Tray, Add, F3: Restart, Restart
Menu, Tray, Add, F4: About, About
Menu, Tray, Add
Menu, Tray, Add, HighScores, HighScores
Menu, Tray, Add
Menu, Tray, Add, Esc: Exit, Exit
Gui, 3:Color, 000000
Gui, 3:Add, Picture, vPause x5 y5 w496 h300 , %FilePath%\Pause2.bmp
Gui, 4:Color, 000000
Gui, 4:Font, S11 CGreen, Arial
Gui, 4:Add, Picture, x35 y5, %Logo%
Gui, 4:Add, Button, gokay x132 y320 w100 h30 , Okay
Gui, 4:Add, Text, x14 y100 w340 h210 , E-nvaderz is a fun game that was fashioned to be similar to the classic game Invaders. All sound effects, were in fact, done by voice. Press ESC to exit the game at any time or use F3 to restart. Have fun and enjoy shooting up some E-nvaderz!`n`nAuthor: Eedis`nEmail: Eedis@gmx.us`nWebsite: http://www.autohotkey.net/~Eedis`nLanguage: AutoHotKey`nVersion: 1.1
Gui, 5:Color, 000000
Gui, 5:Font, S18 CGreen, Terminal
Gui, 5:Add, Text, x7 y5 w98 h60, HighScore
Gui, 5:Font, S8 CGreen, Terminal
Gui, 5:Add, Text, x0 y25 w110 h10 +BackgroundTrans, __________________________________
Gui, 5:Font, S11 CGreen, Arial
Gui, 5:Add, Text, vH x6 y50 w320 h170 , 1: %1Name% - %1Score%`n2: %2Name% - %2Score%`n3: %3Name% - %3Score%`n4: %4Name% - %4Score%`n5: %5Name% - %5Score%`n6: %6Name% - %6Score%`n7: %7Name% - %7Score%`n8: %8Name% - %8Score%`n9: %9Name% - %9Score%`n10: %10Name% - %10Score%
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Build and show the start screen;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
StartLogo:
Gui, Color, 000000
Gui, Add, Picture, vStart x5 y5 w496 h300 , %FilePath%\nStart2.bmp
Gui, Add, Picture, vF1Start x125 y425 w250 h50 , %FilePath%\nF1Start2.bmp
Gui, Show, w506 h500, E-nvaderz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Cause start screen to flash;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
StartScreen:
Suspend, On
Loop
{
If (theme = 1)
{
SoundPlay, %SoundPath%\theme.wav
theme=0
}
loop 2
{
GuiControl,, Start, %FilePath%\nStart%A_Index%.bmp
GuiControl,, F1Start, %FilePath%\nF1Start%A_Index%.bmp
If (State = 1)
Break
sleep 500
}
If (State = 1)
Break
}
;;;;;;;;;;;;;;;;;;;
;;Builds game GUI;;
;;;;;;;;;;;;;;;;;;;
Start:
Gui, Destroy
Gui, Color, 000000
Gui, Font, CWhite
Gui, Add, Text, vFPS x2 y485 w50 h20, FPS:
Gui, Add, Text, vLives x57 y485 w50 h20, Lives: %Ship_Lives%
Gui, Add, Text, vGLevel x105 y485 w50 h20, Level: %Level%
Gui, Add, Text, vGScore x160 y485 w60 h20, Score: %Score%
Gui, Add, Text, vOneUp x230 y510 w180 h20, You've gained a life. %ScoreTNL% to next.
Gui, Add, Picture, vShip x%Ship_X% y%Ship_Y% w25 h20 , %Ship%
Gui, Add, Picture, vBull x-15 y-15, %bullet%
Gui, Add, Picture, vBonShip x-35 y5, %BonShip%
Gui, Add, Picture, vEnBull x-15 y-15, %FilePath%\EnBull2.bmp
Gui, Show, w506 h500, E-nvaderz
Loop 9
{
If (Level < 6)
Gui, Add, Picture, vEnShip%A_Index% x%xx% y30 w25 h20, %FilePath%\EnShip%level%.bmp
If (Level > 5)
{
Random, RanEn, 1, 4
Gui, Add, Picture, vEnShip%A_Index% x%xx% y30 w25 h20, %FilePath%\EnShip%RanEn%.bmp
}
xx+=40
}
xx=100
Loop 18
{
If (A_Index < 10)
Continue
If (Level < 6)
Gui, Add, Picture, vEnShip%A_Index% x%xx% y55 w25 h20, %FilePath%\EnShip%level%.bmp
If (Level > 5)
{
Random, RanEn, 1, 4
Gui, Add, Picture, vEnShip%A_Index% x%xx% y55 w25 h20, %FilePath%\EnShip%RanEn%.bmp
}
xx+=40
}
xx=100
Loop 27
{
If (A_Index < 19)
Continue
If (Level < 6)
Gui, Add, Picture, vEnShip%A_Index% x%xx% y80 w25 h20, %FilePath%\EnShip%level%.bmp
If (Level > 5)
{
Random, RanEn, 1, 4
Gui, Add, Picture, vEnShip%A_Index% x%xx% y80 w25 h20, %FilePath%\EnShip%RanEn%.bmp
}
xx+=40
}
xx=100
Loop 36
{
If (A_Index < 28)
Continue
If (Level < 6)
Gui, Add, Picture, vEnShip%A_Index% x%xx% y105 w25 h20, %FilePath%\EnShip%level%.bmp
If (Level > 5)
{
Random, RanEn, 1, 4
Gui, Add, Picture, vEnShip%A_Index% x%xx% y105 w25 h20, %FilePath%\EnShip%RanEn%.bmp
}
xx+=40
}
sleep 1000
CanBull = 1
Suspend, Off
;;;;;;;;;;;;;;;;;;;;;;
;;The main game loop;;
;;;;;;;;;;;;;;;;;;;;;;
Game:
GuiControl,, GLevel, Level: %Level%
SetTimer, BonShip, 20000
If (Level = 5)
{
EnShipHp=2
SetTimer, BonShip, off
}
Loop 36
EnShipHp%A_Index%=%EnShipHp%
LastFrame=0
SetTimer, CheckFPS, 1000
SetTimer, CanEnFire, 2000
Loop
{
Score()
CurFrame=%A_Index%
GuiControl,, FPS, FPS: %FPS%
MoveBull()
CheckBull()
CheckCollision()
EnemyAI()
LoseCheck()
WinCheck()
Sleep 50
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Randomization for enemy fire;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CanEnFire:
Random, EnFire, 1, 2
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Randomization for bonus ship;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BonShip:
Random, CanBonShip, 1, 2
Random, BonDir, 1, 2
Return
;;;;;;;;;;;;;;;;;;;;;
;;Calculate the FPS;;
;;;;;;;;;;;;;;;;;;;;;
CheckFPS:
FPS:= CurFrame - LastFrame
LastFrame=%CurFrame%
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;When the player gets hit or loses;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Lose:
Suspend, On
SoundPlay, %SoundPath%\kadoosh.wav, wait
If (LBS = 1 AND Ship_Lives > 0)
{
Ship_Lives--
LBS=0
Kills=0
xx=100
Dir=1
GuiControl,, Lives, Lives: %Ship_Lives%
Suspend, Off
Goto Start
}
If (Ship_Lives > 0)
{
Ship_Lives--
GuiControl,, Lives, Lives: %Ship_Lives%
Suspend, Off
Goto Game
}
TotalTime:= A_TickCount - StartTime
TotalTime/=1000
Score()
Gosub CheckHighScore
SetTimer, ChangeButtonNames, 50
MsgBox, 4, Play Again or Exit, You've lost! You made it to level %level%.`n`nStatistics:`nScore = %Score%`nTotal Kills = %TotalKills%`nShots fired = %ShotsFired%`nTotal play time = %TotalTime% seconds
IfMsgBox, YES
Reload
Else
ExitApp
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Changes message box controls;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ChangeButtonNames:
{
IfWinNotExist, Play Again or Exit
Return
SetTimer, ChangeButtonNames, off
WinActivate
ControlSetText, Button1, &Play Again
ControlSetText, Button2, &Exit
Return
Msgbox, 0, E-nvaderz, You've lost! You made it to level %level%.`nStatistics:`nTotal Kills = %TotalKills%`nShots fired = %ShotsFired%`nTotal play time = %TotalTime% seconds
ExitApp
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;When player beats a level;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Win:
{
Suspend, On
SoundPlay, %SoundPath%\up.wav
CanBull = 0
EnBullCount=0
CanBull=1
GuiControl, Move, EnBull, x-15 y-15
GuiControl, Move, Bull, x-15 y-15
Msgbox, 0, E-nvaderz, You've beaten level %level%!
If (level = 5)
{
Score+=35
EnShipHp=1
EnShip_Speed=7
}
Kills%level%=%Kills%
EnShip_Speed+=1
Level+=1
Kills=0
xx=100
Dir=1
If (Level = 5)
{
EnShip_Speed=4
Msgbox, 0, E-nvaderz, Prepare for boss stage!
}
sleep 200
Gosub Start
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;When player pauses the game;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Pause:
{
If (Pause < 2)
{
If (Pause = 0)
{
Gui, Hide
SoundPlay, %SoundPath%\pause.wav
Gui, 3:Show, w506 h500, E-nvaderz
Pause = 1
}
Else
{
Gui, Show
SoundPlay, %SoundPath%\unpause.wav
Gui, 3:Hide
Pause = 0
}
Suspend, Toggle
Pause, Toggle, 1
}
}
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Display highscore screen;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
HighScores:
Loop 10
{
IniRead, %A_Index%Name, HighScore.ini, HighScore, %A_Index%Name
IniRead, %A_Index%Score, HighScore.ini, HighScore, %A_Index%Score
}
GuiControl, 5:, H, 1: %1Name% - %1Score%`n2: %2Name% - %2Score%`n3: %3Name% - %3Score%`n4: %4Name% - %4Score%`n5: %5Name% - %5Score%`n6: %6Name% - %6Score%`n7: %7Name% - %7Score%`n8: %8Name% - %8Score%`n9: %9Name% - %9Score%`n10: %10Name% - %10Score%
WinGetPos, WinX, WinY, WinWidth,, E-nvaderz
Winx+=%WinWidth%
Gui, 5:Show, x%Winx% y%WinY% w115 h225, HighScores
Return
;;;;;;;;;;;;;;;;;;;;;;;;
;;Calculates highscore;;
;;;;;;;;;;;;;;;;;;;;;;;;
CheckHighScore:
Loop 10
{
IniRead, %A_Index%Name, HighScore.ini, HighScore, %A_Index%Name
IniRead, %A_Index%Score, HighScore.ini, HighScore, %A_Index%Score
}
Loop 10
{
CurScore:= %A_Index%Score
If (Score > CurScore)
{
InputBox, Name, New Record, Congratsulations! You have a new record in %A_Index% place! Please insert your name below.,, 175, 150,,,,, Name
If (ErrorLevel = 1)
Break
IniWrite, %Score%, HighScore.ini, HighScore, %A_Index%Score
IniWrite, %Name%, HighScore.ini, HighScore, %A_Index%Name
MSI:= A_Index
Loop 10
{
If (A_Index < MSI)
Continue
MS:= A_Index + 1
CurMSIName:= %A_Index%Name
CurMSIScore:= %A_Index%Score
IniWrite, %CurMSIName%, HighScore.ini, HighScore, %MS%Name
IniWrite, %CurMSIScore%, HighScore.ini, HighScore, %MS%Score
}
Gosub HighScores
Break
}
}
Return
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;When player restarts the game;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Restart:
Gui, 4:Destroy
Reload
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Display the about section;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
About:
Gui, 4:Show, w360 h355, About E-nvaderz
Return
okay:
gui, 4:hide
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Calculates and keeps track of extra lives;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1up:
Index++
If (Index = 1)
{
GuiControl, Move, OneUp, x230 y485
SetTimer, 1up, 3000
}
If (Index = 2)
{
GuiControl, Move, OneUp, x510 y485
Index = 0
SetTimer, 1up, off
}
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function to calculate score;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Score()
{
Global
Level--
TotalKills=36
TotalKills*=%level%
TotalKills+=%Kills%
BonScoreMult:= BonShipKills * 60
ScoreMult:= Level * 20
ScoreDeduc:= ShotsFired - TotalKills
Score:= TotalKills * 5 + ScoreMult + BonScoreMult - ScoreDeduc
Level++
GuiControl,, GScore, Score: %Score%
If (Score >= ScoreTNL)
{
Ship_Lives++
ScoreTNL+=250
GuiControl,, OneUp, You've gained a life. %ScoreTNL% to next.
SetTimer, 1up, 10
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function to check to see if player won;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WinCheck()
{
global
If (Kills >= 36)
Gosub Win
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function to check to see if player lost;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LoseCheck()
{
Global
loop 36
{
GuiControlGet, EnShippos%A_Index%, Pos, EnShip%A_Index%
CurEnShipy:=% EnShippos%A_Index%y
If (CurEnShipy > 420)
{
LBS=1
Gosub Lose
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function to check for bullet collisions;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CheckCollision()
{
global
loop 36
{
GuiControlGet, EnShippos%A_Index%, Pos, EnShip%A_Index%
GuiControlGet, Bullpos, Pos, Bull
Bullposx+=5
CurEnShipp:=% EnShip%A_Index%
CurEnShipx:=% EnShippos%A_Index%x
CurEnShipy:=% EnShippos%A_Index%y
CurEnShipxx:=CurEnShipx + 25
CurEnShipyy:=CurEnShipy + 20
If (Bullposx >= CurEnShipx AND Bullposx <= CurEnShipxx AND Bullposy >= CurEnShipy AND Bullposy <= CurEnShipyy)
{
EnShipHp%A_Index%--
CurEnShiphp:=% EnShipHp%A_Index%
SoundPlay, %SoundPath%\bang.wav
BullHit=1
CanBull=1
GuiControl, Move, Bull, x-15 y-15
If (CurEnShipHp < 1)
{
CurEnShipy-=1000
GuiControl, Move, EnShip%A_Index%, x%CurEnShipx% y%CurEnShipy%
Kills++
}
}
}
GuiControlGet, Shippos, Pos, Ship
GuiControlGet, EnBullpos, Pos, EnBull
EnBullposx+=5
EnBullposy+=8
CurShipx=%Shipposx%
CurShipy=%Shipposy%
CurShipxx:=CurShipx + 25
CurShipyy:=CurShipy + 20
If (EnBullposx >= CurShipx AND EnBullposx <= CurShipxx AND EnBullposy >= CurShipy AND EnBullposy <= CurShipyy)
{
GuiControl, Move, EnBull, x-15 y-15
EnBullCount=0
Gosub Lose
}
If (CanBonShip = 1)
{
GuiControlGet, BonShippos, Pos, BonShip
GuiControlGet, Bullpos, Pos, Bull
Bullposx+=5
CurBonShipx=%BonShipposx%
CurBonShipy=%BonShipposy%
CurBonShipxx:=CurBonShipx + 35
CurBonShipyy:=CurBonShipy + 20
If (Bullposx >= CurBonShipx AND Bullposx <= CurBonShipxx AND Bullposy >= CurBonShipy AND Bullposy <= CurBonShipyy)
{
CanBonShip = 0
BullHit=1
GuiControl, Move, Bull, x-15 y-15
GuiControl, Move, BonShip, x-35 y5
SoundPlay, %SoundPath%\bang.wav
CanBull=1
BonShipKills++
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function that controls the enemy ships;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EnemyAI()
{
global
GuiControlGet, EnShippos, Pos, EnShip1
If (EnShipposx > 7 AND Dir = 1)
{
loop 36
{
GuiControlGet, EnShippos%A_Index%, Pos, EnShip%A_Index%
CurEnShipx:=% EnShippos%A_Index%x
CurEnShipy:=% EnShippos%A_Index%y
CurEnShipx-=%EnShip_Speed%
GuiControl, Move, EnShip%A_Index%, x%CurEnShipx% y%CurEnShipy%
}
}
GuiControlGet, EnShippos, Pos, EnShip1
If (EnShipposx < 7)
{
Dir=0
loop 36
{
GuiControlGet, EnShippos%A_Index%, Pos, EnShip%A_Index%
CurEnShipx:=% EnShippos%A_Index%x
CurEnShipy:=% EnShippos%A_Index%y
CurEnShipx+=%EnShip_Speed%
CurEnShipy+=%EnShip_DropSpeed%
GuiControl, Move, EnShip%A_Index%, x%CurEnShipx% y%CurEnShipy%
}
SoundPlay, %SoundPath%\dirk.wav
}
GuiControlGet, EnShippos, Pos, EnShip9
If (EnShipposx < 468 AND Dir = 0)
{
loop 36
{
GuiControlGet, EnShippos%A_Index%, Pos, EnShip%A_Index%
CurEnShipx:=% EnShippos%A_Index%x
CurEnShipy:=% EnShippos%A_Index%y
CurEnShipx+=%EnShip_Speed%
GuiControl, Move, EnShip%A_Index%, x%CurEnShipx% y%CurEnShipy%
}
}
GuiControlGet, EnShippos, Pos, EnShip9
If (EnShipposx > 467)
{
Dir=1
loop 36
{
GuiControlGet, EnShippos%A_Index%, Pos, EnShip%A_Index%
CurEnShipx:=% EnShippos%A_Index%x
CurEnShipy:=% EnShippos%A_Index%y
CurEnShipx-=%EnShip_Speed%
CurEnShipy+=%EnShip_DropSpeed%
GuiControl, Move, EnShip%A_Index%, x%CurEnShipx% y%CurEnShipy%
}
SoundPlay, %SoundPath%\dirk.wav
}
If (EnFire = 1)
{
Random, WhichShip, 1, 36
GuiControlGet, EnShippos, Pos, EnShip%WhichShip%
If (EnShipposy > 0)
{
EnShip_Y=%EnShipposy%
EnShip_Y+=20
EnShip_X=%EnShipposx%
EnShip_X+=10
EnBullx=%EnShip_X%
EnBully=%EnShip_Y%
GuiControl, Move, EnBull, x%EnShip_X% y%EnShip_Y%
SoundPlay, %SoundPath%\pyu.wav
EnBullCount=1
EnFire=2
}
}
If (CanBonShip = 1)
{
GuiControlGet, BonShippos, Pos, BonShip
If (BonDir = 1)
{
BonShipposx+=%EnShip_Speed%
GuiControl, Move, BonShip, x%BonShipposx% y%BonShipposy%
If (BonShipposx > 500)
{
CanBonShip = 0
GuiControl, Move, BonShip, x-35 y5
}
}
If (BonDir = 2)
{
If not (D = 1)
{
GuiControl, Move, BonShip, x506 y%BonShipposy%
BonShipposx=506
D=1
}
BonShipposx-=%EnShip_Speed%
GuiControl, Move, BonShip, x%BonShipposx% y%BonShipposy%
If (BonShipposx < -35)
{
CanBonShip = 0
D=0
GuiControl, Move, BonShip, x-35 y5
}
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function to check if bullet goes off screen;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CheckBull()
{
Global
GuiControlGet, Bullpos, Pos, Bull
If (Bullposy < -15)
{
GuiControl, Move, Bull, x-15 y-15
CanBull=1
}
GuiControlGet, EnBullpos, Pos, EnBull
If (EnBullposy > 500 AND EnBullCount = 1)
{
GuiControl, Move, EnBull, x-15 y-15
EnBullCount=0
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Function to move bullet accross screen;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MoveBull()
{
Global
If (BullHit = 0)
{
Bully-=%BullSpeed%
GuiControl, Move, Bull, x%Bullx% y%Bully%
}
If (EnBullCount = 1)
{
EnBully+=%BullSpeed%
GuiControl, Move, EnBull, x%EnBullx% y%EnBully%
}
}
;;;;;;;;;;;;;;;;;;;
;;Various hotkeys;;
;;;;;;;;;;;;;;;;;;;
F1::
#IfWinActive, E-nvaderz
Suspend, Permit
State=1
Return
F2::
#IfWinActive, E-nvaderz
Suspend, Permit
Gosub Pause
Return
F3::
#IfWinActive, E-nvaderz
Gosub Restart
Return
F4::
#IfWinActive, E-nvaderz
Suspend, Permit
Gosub About
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Moves player ship left or right and fires;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Left::
#IfWinActive, E-nvaderz
if (Ship_X < 7)
Ship_X+=%Ship_Speed%
Ship_X-=%Ship_Speed%
GuiControl, Move, Ship, x%Ship_X% y%Ship_Y%
SoundPlay, %SoundPath%\beep.wav
Return
Right::
#IfWinActive, E-nvaderz
if (Ship_X > 468)
Ship_X-=%Ship_Speed%
Ship_X+=%Ship_Speed%
GuiControl, Move, Ship, x%Ship_X% y%Ship_Y%
SoundPlay, %SoundPath%\beep.wav
Return
Space::
#IfWinActive, E-nvaderz
If (CanBull = 1)
{
ShotsFired++
Ship_Y2=%Ship_Y%
Ship_Y2-=10
Ship_X2=%Ship_X%
Ship_X2+=10
Bullx=%Ship_X2%
Bully=%Ship_Y2%
CanBull--
BullHit=0
GuiControl, Move, Bull, x%Ship_X2% y%Ship_Y2%
SoundPlay, %SoundPath%\pyu.wav
Send, {Space up}
}
Return
;;;;;;;;;;;;;;;;
;;Exit program;;
;;;;;;;;;;;;;;;;
Esc::
#IfWinActive, E-nvaderz
Suspend, Permit
Exit:
GuiClose:
ExitApp