AutoHotkey Community

It is currently May 27th, 2012, 12:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: April 7th, 2010, 9:53 pm 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
**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:
Image

Image

Image

Image

Image

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

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Last edited by Eedis on April 10th, 2010, 8:36 pm, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2010, 10:06 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
I gave it a try.. Impressive! :o
The sounds could be better.. would be cool if it had arcade-game type sound.
Also, it would be great if the user could steer the ship with a left/right longpress

:)

:arrow: Note: The installer needs to notify the path it is installing into and take a confirmation from the user.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2010, 10:32 pm 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
SKAN wrote:
Also, it would be great if the user could steer the ship with a left/right longpress

http://www.autohotkey.com/forum/viewtop ... ht=#345738 Lolz, I've actually been searching for a solution to that. Any ideas? **EDIT** I have the solution! I just need to get home and fix it. :(

As for the installer, I put that one together real quick to share with my friends. I haven't had time to create an installer with a GUI and such yet, but I plan to.

Thanks for the comments. :)

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2010, 8:55 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Quote:
I have the solution! I just need to get home and fix it.


Great!
BTW, why have not you posted a screenshot? :roll:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2010, 6:10 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
The graphics are very nice, kudos!

I noticed a couple issues with the hotkeys.
1.) You should use #IfWinActive to bind the hotkeys only to your game. I had to close the game to type this message, because I had no spacebar. :P
2.) Holding down the spacebar for a couple seconds produces the #MaxHotkeysPerInterval warning. An easy workaround is to use Space UP for shooting.

P.S. Any progress on Checkers? :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2010, 10:03 pm 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
jaco0646 wrote:
1.) You should use #IfWinActive to bind the hotkeys only to your game. I had to close the game to type this message, because I had no spacebar.
I've noticed this also, I was planning on fixing it but totally forgot. >.<Thanks.

jaco0646 wrote:
2.) Holding down the spacebar for a couple seconds produces the #MaxHotkeysPerInterval warning. An easy workaround is to use Space UP for shooting.
Hmmm... It doesn't do that to me. Oh well, if it happens to others, I will still fix it. Thanks. :)

jaco0646 wrote:
P.S. Any progress on Checkers?
You know what's funny? After I finished that game, I had ideas for others. Then I started to think. I'm going to finish checkers and just randomly PM it to jaco. XD

SKAN wrote:
BTW, why have not you posted a screenshot?
Just edited the original post. :D

Also, I've noticed that some of the text fields cut off... Well, the reason for this. When I made the game, I used a font I found in Microsoft. What I forgot was, I downloaded that font about 3 years earlier. So I thought it came with Windows, but it didn't. So the font is erroring out. :\ My solution. I'll just provide the font with the installer. :D..... When I get around to updating it. Which, I promise will be a day or two... Or next time I come to my mom's house to use the internet.... Or until I get internet at my apartment.

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2010, 11:22 pm 
Offline

Joined: January 13th, 2009, 10:02 pm
Posts: 31
*removed*


*edit*
I've found the problem, after installation there are no images or sound... :roll:
I used the normal installer...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2010, 12:21 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
If you're using Vista, I've seen this on my brother's computer also, the installer didn't install properly. The only thing I can guess is Vista's compatibility. I can provide a RAR here that you can download the images and sounds separately for a manual install. It worked for my brother. Just put the folders in the same directory E-nvaderz is in.

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2010, 12:33 am 
Eedis wrote:
I can provide a RAR...

...sorry, but why RAR? Not zip or 7zip?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2010, 12:58 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
Also, just a few easter eggs about the game.

1. At first, the game only had one graphic as the enemies. The first level enemies were the enemies through out the whole game. My mom played it and told me to make more enemies. So I did.

2. What the Enemies were modeled after:
Level 1: The flying, psychic, brain looking monster from Hexen 64, about 5-6 levels into the game.
Level 2: Believe it or not, I modeled this after Cell from Dragon Ball Z. O.O I used to watch that when I was a kid, and for some strange reason, he popped up in my head.
Level 3: I modeled these after the Zerg Drones from Starcraft. :D
Level 4: Okay, I made these at about 5 o'clock while I couldn't sleep, so I was tired, and wanted to finish. These guys weren't modeled after anything. Was me just simply doodling because I couldn't think of anything to do.
Level 5: The boss level... I was seriously out of ideas and wanted to go to bed. So I just took the guys from level 4 and changed a few colors, added and took away from a few details, and made them grayish to look like they had armor or something.
Level 6+: Well, this is just a randomization of all the enemies because I simply got to tired to make more.

3. When you pause the game, you can FAINTLY here my daughter crying in the background when it plays the pause sound. It kind of sounds like a door creaking open.

4. The images have various numbers after them because I had previous designs that I eventually didn't like.

5. I think the RAR included a few scripts in the sounds folder that just run the sounds themselves. I tried a work around from the sounds getting cut off but running the individual scripts instead of soundplaying them, but it lagged way to much. I forgot to delete the scripts.

6. Under highscores, the EGG name is added for a reason. When I used to visit the arcade a lot, I got first place on the original Joust. FIRST PLACE. Get this, the game bugged out when I was entering my initials. Instead of putting my name "Eli", it put "Egg". So now I have no proof that the first place score is mine. :( The other names are there for significant reasons also. Try to figure out why. ;) A few maybe quite obvious.

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2010, 4:25 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
Eedis wrote:
It doesn't do that to me.
Really? You can hold down the spacebar all day with no error message?

Eedis wrote:
I had ideas for others.
Please share! :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2010, 8:27 pm 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
Quote:
Really? You can hold down the spacebar all day with no error message?

Yeah, I played the game so freaking much while I was making it to fine tune it and everything, I discovered that is the fastest way. XD

I have an idea for an adventure game, kind of like 2d Zelda. Only, it'll be one dungeon, lolz. Right now, I'm still drawing up the dungeon floor plans and stuff on graph paper before I start putting it on the computer. I will call this game, E-dventure. Your character's name will be Ed. :)

I also updated the game.

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2011, 6:22 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
...continued from GuiControl, Delete.

Determine the maximum number of enemies the game will need at one time. Create them all at the outset. Per level, hide/show a desired subset of these with GuiControl, Hide; and also change their pictures accordingly. After level one, you will also need GuiControl, Move to reassemble the enemies into a desired pattern.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2011, 6:36 pm 
Offline

Joined: May 1st, 2010, 6:01 pm
Posts: 1020
Location: England
Quote:
I have an idea for an adventure game, kind of like 2d Zelda. Only, it'll be one dungeon, lolz. Right now, I'm still drawing up the dungeon floor plans and stuff on graph paper before I start putting it on the computer. I will call this game, E-dventure. Your character's name will be Ed. Smile


i would love to help you with any graphics / coding

x79_animal@hotmail.co.uk


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2011, 7:03 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
It would be nice if your uninstall code deleted itself also
Code:
Run, %comspec% /c del "%A_ScriptFullPath%",,Hide
ExitApp


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, bowen666, Yahoo [Bot] and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group