Jump to content

Help with making a game (guitar hero)


Zisly
 Share

Recommended Posts

Well I decided to try to make a game like guitar hero, but I can't think of a good way to handle the falling notes...

Maybe someone could tell me a good way :), my "way" right now sucks..

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <misc.au3>
#include <sound.au3>
#include <file.au3>
Global $media = _SoundOpen("1.mp3"),$00_05 = 0,$00_06to1 = 0

Global $00_05 = 0, $00_06to12 = 0
#Region ### START Koda GUI section ### Form=
$gui = GUICreate("Guitar Hero On AutoIt", 371, 363, 166, 107)
GUISetBkColor(0x000000)
$Pic2 = GUICtrlCreatePic("bk.bmp", 0, 0, 262, 362, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("Score", 288, 16, 51, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$muspos = GUICtrlCreateLabel("                         ", 272, 128, 104, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x00FF00)
$Label4 = GUICtrlCreateLabel("Elapsed", 288, 112, 49, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("", 264, 40, 100, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x00FF00)
$green = GUICreate("", 33, 27, 16, 8, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
$gre = GUICtrlCreatePic("green.bmp", 0, 0, 0, 0)
$red = GUICreate("", 33, 27, 80, 8, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
$redd = GUICtrlCreatePic("red.bmp", 0, 0, 0, 0)
GUISetState(@SW_SHOW, $Pic2)
GUISetState(@SW_SHOW, $gui)
GUISetState(@SW_SHOW, $green)
GUISetState(@SW_SHOW, $red)
#EndRegion ### END Koda GUI section ###
HotKeySet("{f5}", "note_green")
HotKeySet("{f6}", "note_red")


AdlibEnable("mus_pos", 300)
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    If GUICtrlRead($muspos) > "00:00:05" And $00_05 = 0 Then notedropr(10, 2)
    If GUICtrlRead($muspos) > "00:00:06" And $00_06to12 = 0 Then notedropr(10, 2)
WEnd



Func notedropg($delay, $pix_move)
    $greenPos = WinGetPos($green)
    If $greenPos[1] > 470 Then
        GUIDelete($green)
        $green = GUICreate("", 33, 27, 16, 8, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
        $gre = GUICtrlCreatePic("green.bmp", 0, 0, 0, 0)
        GUISetState(@SW_SHOW, $green)
    Else
        WinMove($green, "", $greenPos[0], $greenPos[1] + $pix_move)
        Sleep($delay)
    EndIf
EndFunc   ;==>notedropg

Func notedropr($delay, $pix_move)
    $redPos = WinGetPos($red)
    If $redPos[1] > 470 Then
        show_red("00_06to12")
        $00_06to12 = 1
        $00_05 = 1
    Else
        WinMove($red, "", $redPos[0], $redPos[1] + $pix_move)
        Sleep($delay)
    EndIf
EndFunc   ;==>notedropr


Func show_red($ha)
    $ha = 1
GUIDelete($red)
$red = GUICreate("", 33, 27, 80, 8, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
$re = GUICtrlCreatePic("red.bmp", 0, 0, 0, 0)
GUISetState(@SW_SHOW, $red)
EndFunc

Func note_green()
        $greenPos = WinGetPos($green)
        If $greenPos[1] > 440 Then
            GUIDelete($green)
            $getpoint = GUICtrlRead($Label2)
            GUICtrlSetData($Label2, $getpoint + 100)
            $green = GUICreate("", 33, 27, 16, 8, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
            $gre = GUICtrlCreatePic("green.bmp", 0, 0, 0, 0)
            GUISetState(@SW_SHOW, $green)
        Else
            Sleep(1)
        EndIf
EndFunc   ;==>note_green

Func note_red()
        $redPos = WinGetPos($red)
        If $redPos[1] > 440 Then
            GUIDelete($red)
            $red = GUICreate("", 33, 27, 80, 8, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui)
            $re = GUICtrlCreatePic("red.bmp", 0, 0, 0, 0)
            GUISetState(@SW_SHOW, $red)
            $getpoint = GUICtrlRead($Label2)
            GUICtrlSetData($Label2, $getpoint + 100)
        Else
            Sleep(1)
        EndIf
EndFunc   ;==>note_read


Func mus_pos()
    GUICtrlSetData($muspos, _SoundPos($media, 1))
    _SoundPlay($media)
EndFunc   ;==>note_creation

For those who don't know what guitar hero is, it is a guitar game where your "mission" is to hit falling notes.

Thanks,

Zisly,

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...