Sign in to follow this  
Followers 0
Vindicator209

Dragon Chase!

11 posts in this topic

#1 ·  Posted (edited)

This little game was originally meant to be a Helicopter-like game, but the ceiling/floor movement was too time consuming and I gave up and reversed it.

So basically you're a little rocket ship dodging fireballs which get faster and faster the the further you go along. You use the spacebar to contol the hieght of the ship(a helicopter-like control, but I didn't like using mous down...)

And because it is a bit annoying when you accidentally touch the very tail of the fireball and die, I gave you "health" which you usually get 2/3 hits before dying. hitting the walls however is an instant death.

Complete Edit

You'll need to download the .zip file with all the images and sounds too for it to run.

Posted Image

Complete Edit

Heres the bare script:

EDIT: Added the warning right when you start the game

EDIT: Your ship speed increases at 2x

EDIT: Fireballs stop increasing speed at 3x (3.45 is impossible)

#include <GUIConstants.au3>
#include <Misc.au3>
HotKeySet("{TAB}","test")
If Not(FileExists("HighScore.ini"))Then
IniWrite("HighScore.ini","Highscore","Name","Anonymous")
IniWrite("HighScore.ini","Highscore","Score","10")
EndIf
$Testing = False
$Rate = 1
$isDead = False
$Hpos = 250
$Other = 1
$Block = -1
$Health = 100
$dll = DllOpen("user32.dll")
$NewBlock = False
$Form1 = GUICreate("Dragon Chase - By Vindicator", 600, 500, 193, 125)
$Counter = GUICtrlCreateLabel("0 Feet", 250, 245, 200, 20)
GUICtrlSetColor(-1, 0xffffff)
$Speedm = GUICtrlCreateLabel("Speed: x1", 250, 265, 200, 20)
GUICtrlSetColor(-1, 0xffffff)
$Slate_Gray = 0x000000
GUISetBkColor($Slate_Gray)
$Refresh = GUICtrlCreateButton("Refresh", 400, 200, 50, 20)
GUICtrlSetState(-1, $GUI_HIDE)
$Heli = GUICtrlCreatePic("Heli.bmp", 500, 250, 75, 50)
Dim $T[25]
Dim $B[25]
Dim $BD[25]
For $i = 0 To 24
    $ran = 30 + Random(0, 30, 1)
    $BP = 400 + $ran
    $TH = $ran
    If $BP > 600 Then $BP = 610
    If $TH < 0 Then $TH = 10
    $T[$i] = GUICtrlCreatePic("green.bmp", $i * 25, 0, 25, $TH)
    $B[$i] = GUICtrlCreatePic("green.bmp", $i * 25, $BP, 25, 200)
    $BD[$i] = $BP
Next
GUISetState(@SW_SHOW)
$Timer = TimerInit()
    MsgBox(0,"Dragon Chase!","Get Ready!" & @CRLF & "The fireballs will get faster and faster  the farther you go! Be sure not to hit the walls!" & @CRLF & "Use the SPACEBAR to control your height! Hold space bar to go higher, left go to go lower!")
While 1
    $nMsg = GUIGetMsg()
    If $Testing = True Then $isDead = False
    GUICtrlSetData($Counter, Round(TimerDiff($Timer) / 100, 0) * 3 & " feet Traveled | " & $Health & " Health")
    If $isDead = True Then
        $Dist = Round(TimerDiff($Timer) / 100, 0) * 3
        MsgBox(0, "Explode!", "You survived " & $Dist & " Feet!")
        If $Dist > IniRead("HighScore.ini","Highscore","Score",9999) Then
            $Name = IniRead("HighScore.ini","Highscore","Name",9999)
            $Score = IniRead("HighScore.ini","Highscore","Score",9999)
            MsgBox(0, "Explode!", "You beat "&$Name&"'s Highscore of "&$Score&" feet!")
            $User = InputBox("Enter your Highscore!","Enter your name into the Highscores!")
            IniWrite("HighScore.ini","Highscore","Name",$User)
            IniWrite("HighScore.ini","Highscore","Score",$Dist)
        EndIf
        $iMsgBoxAnswer = MsgBox(52,"Play again?","Would you like to play again?")
        Select
            Case $iMsgBoxAnswer = 6 ;Yes
                GUICtrlSetData($Speedm,"Speed: x1")
                $isDead = False
                GUICtrlSetImage($Heli, "Heli.bmp")
                GUICtrlSetPos($Heli, 50, 250)
                GUICtrlDelete($Block)
                $NewBlock = False
                $Hpos = 250
                $Timer = TimerInit()
                $Health = 100
            Case $iMsgBoxAnswer = 7 ;No
                Exit
        EndSelect
    EndIf
    If $isDead = False Then
        If _IsPressed("20", $dll) Then
            If $Rate > 2 Then
            $Hpos -= 10
        Else
            $Hpos -= 5
        EndIf
    Else
            If $Rate > 2 Then
            $Hpos += 15
        Else
             $Hpos += 10
             EndIf 
        EndIf
        GUICtrlSetPos($Heli, 500, $Hpos)
        If $Hpos < 40 Then
            $isDead = True
            GUICtrlSetImage($Heli, "Explode.bmp")
            SoundPlay("boom.wav", 1)
        EndIf
        If $Hpos > 400 Then
            $isDead = True
            GUICtrlSetImage($Heli, "Explode.bmp")
            SoundPlay("boom.wav", 1)
        EndIf
    EndIf
    If $Other = 1 And $isDead = False Then
        If $NewBlock = False Then
            $BlockVert = Random(5, 20, 1) + $Hpos
            $Block = GUICtrlCreatePic("Fire.bmp", -50, $BlockVert, 150, 100)
            $Bpos = -2
            $NewBlock = True
            SoundPlay("fireball" & Random(1, 3, 1) & ".wav")
        EndIf
        If TimerDiff($Timer) > 5000 Then
            $Rate = 1 + Round(TimerDiff($Timer)/5000,0)/20
            If $Rate > 3 Then
                $Rate = 3
                $Bpos += 3
            Else
                $Bpos += 1 + Round(TimerDiff($Timer)/5000,0)/20
            EndIf
            GUICtrlSetData($Speedm,"Speed: x"&$Rate)
        Else
            $Bpos += 1
        EndIf
        GUICtrlSetPos($Block, $Bpos * 25, $BlockVert)
        If $Bpos > 15 Then
            If $Hpos + 25 > $BlockVert And $Hpos + 25 < $BlockVert + 100 Then
                $Health -= Random(30, 50, 1)
                GUICtrlSetImage($Heli, "Helifire.bmp")
                GUICtrlDelete($Block)
                $NewBlock = False
                If $Health < 1 Then
                    SoundPlay("firedie.wav")
                    If $Testing = False Then $isDead = True
                EndIf
            EndIf
        EndIf
        If $Bpos > 23 Then
            GUICtrlDelete($Block)
            $NewBlock = False
        EndIf
        GUICtrlDelete($T[0])
        GUICtrlDelete($B[0])
        For $i = 1 To 24
            GUICtrlSetPos($T[$i], ($i - 1) * 25, 0)
            GUICtrlSetPos($B[$i], ($i - 1) * 25, $BD[$i])
        Next
        For $i = 0 To 23
            $T[$i] = $T[$i + 1]
            $B[$i] = $B[$i + 1]
            $BD[$i] = $BD[$i + 1]
        Next
        $ran = 30 + Random(0, 30, 1)
        $BP = 400 + $ran
        $TH = $ran
        If $BP > 600 Then $BP = 610
        If $TH < 0 Then $TH = 10
        $T[$i] = GUICtrlCreatePic("green.bmp", $i * 25, 0, 25, $TH)
        $B[$i] = GUICtrlCreatePic("green.bmp", $i * 25, $BP, 25, 200)
        $BD[$i] = $BP
        $Other = 2
    Else
        $Other = 1
    EndIf
    Switch $nMsg
        Case $Refresh
            If $NewBlock = False Then
                $BlockVert = Random(60, 400, 1)
                $Block = GUICtrlCreatePic("dgreen.bmp", 575, $BlockVert, 25, 100)
                $Bpos = 25
                $NewBlock = True
            EndIf
            $Bpos -= 1
            GUICtrlSetPos($Block, $Bpos * 25, $BlockVert, 25, 100)
            If $Bpos < 1 Then
                GUICtrlDelete($Block)
                $NewBlock = False
            EndIf
            GUICtrlDelete($T[0])
            GUICtrlDelete($B[0])
            For $i = 1 To 24
                GUICtrlSetPos($T[$i], ($i - 1) * 25, 0)
                GUICtrlSetPos($B[$i], ($i - 1) * 25, $BD[$i])
            Next
            For $i = 0 To 23
                $T[$i] = $T[$i + 1]
                $B[$i] = $B[$i + 1]
                $BD[$i] = $BD[$i + 1]
            Next
            $ran = 30 + Random(0, 30, 1)
            $BP = 400 + $ran
            $TH = $ran
            If $BP > 600 Then $BP = 610
            If $TH < 0 Then $TH = 10
            $T[$i] = GUICtrlCreatePic("green.bmp", $i * 25, 0, 25, $TH)
            $B[$i] = GUICtrlCreatePic("green.bmp", $i * 25, $BP, 25, 200)
            $BD[$i] = $BP
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Func test()
    $Testing = True
EndFunc

Download .Zip:

From MediaFire

Download PICTURES ONLY (NO SOUND):

http://www.mediafire.com/?nndybnmz4ct

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Looks neat, all i can really suggest is slightly smaller fireballs and DEFINITELY include some sort of warning that the game starts instantly :)

*EDIT*

Keep the fireballs, but include that warning :)

Edited by SxyfrG

My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website

Share this post


Link to post
Share on other sites

Could you please make a zip with the images (may I suggest JPEG's?) and current script available for people with dial-up?

941kb (current mediafire download is quite large for dial-up users)

Not super-important but it'd ease some aggravation.


My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

cool,

[Highscore]

Name=ludocus

Score=651

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Oops, oh yea, by the way, it uses the space bar XD I think I might have forgot to mention that...

@crashdemons

sure, but I can't use JPEGS, autoit won't show them for me... I'll just have all the pictures in a zip for you too (has sounds too..)

@Sxyfrg

Sure, I was going to do that, but I was so tired by the time I posted I just let it slide lol, Il'l get to that now

Okay, Just add this:

MsgBox(0,"Dragon Chase!","Get Ready!" & @CRLF & "The fireballs will get faster and faster  the farther you go! Be sure not to hit the walls!" & @CRLF & "Use the SPACEBAR to control your height! Hold space bar to go higher, left go to go lower!")

right before the While 1 Loop

EDIT:

You know, you'd think the ceiling/floor wouldn't be a problem, but it really does matter when those fireballs get fast

EDIT:

Oh jees, you can't avoid the fireballs when it gets up to x3.45 speed , I should make the controls faster too

Edit:

Okay, the cieling/wall blocks that move really eat ur cpu lol wow I didn't notice it..

EDIT: 3.45x is impossible lol, lets have it stop getting faster at 3x, the dragon's gotta have limits, yea know lol

Edited the first post's script

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

nice game.

high score=1641

Share this post


Link to post
Share on other sites

With the new version, my highscore is 2706.... its slightly easier


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

VindicatorOmega

Nice! Little code interesting game! Thank you for sharing and example. 3 star! :)

You forget closing a dll. For future versions add difficulty level. :)

Share this post


Link to post
Share on other sites

[Highscore]
Name=James
Score=1911

Not bad. Make the images transparent though.

How do I do that?

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0