Jump to content

Kill Petra!


bullygil
 Share

Recommended Posts

Hey!I have this game called Kill Petra!Well..who is Petra?Petra is an old woman...she's one of my old and annoying neighbors.

So...the idea of the game is to make a smaller time to kill Petra.

Here is the source:

#include <GUIConstants.au3>
OPT("GUIOnEventMode",1)
 
MsgBox(0,"Welcome","Press OK to begin!")
$timp=TimerInit()
$gui = GUICreate("Kill Petra!", 633, 454, 193, 115)
$capul_bestiei = GUICtrlCreatePic(@ScriptDir&"\fatza_bestiei.gif", 162, 135, 67, 77, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetCursor (-1, 3)
GUICtrlSetOnEvent($capul_bestiei,"shoot")
$health_label = GUICtrlCreateLabel("Petra's Health", 0, 432, 102, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$petras_health_loadbar = GUICtrlCreateProgress(108, 432, 523, 19)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetData(-1, 100)
$score_label = GUICtrlCreateLabel("Score:",  0, 405, 49, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$score = GUICtrlCreateLabel("0", 54, 405, 39, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE,"quit")

While 1
    GUICtrlSetPos($capul_bestiei,Random(1,600,1),Random(1,400,1))
    Sleep(470)
    If GUICtrlRead($petras_health_loadbar)<=0 Then
        MsgBox(0,"Congratz!","You killed Petra in :"&StringLeft(TimerDiff($timp)/1000,4)&" seconds")
        Exit
    EndIf
WEnd
Func quit()
    Exit
EndFunc

Func shoot()
    $random_num=Random(1,3,1)
    GUICtrlSetData($petras_health_loadbar,GUICtrlRead($petras_health_loadbar)-$random_num)
    Guictrlsetdata($score,GUICtrlRead($score)+$random_num)
    $random_injuratura=Random(1,2,1)
    if $random_injuratura=1 Then
        SoundPlay(@ScriptDir&"\hai_sictir.mp3")
    ElseIf $random_injuratura=2 Then
        SoundPlay(@scriptDir&"\mama_dracu.mp3")
    EndIf
EndFunc

And here is the archive(contains the sounds and the image with Petra's head)

Download

BTW:That sounds that you will hear when you hit her, is just her, insulting me when i tryed to record her :)

Enjoy the game :P

Link to comment
Share on other sites

Excellent idea! Not that I understood any of the dialogue by Petra...

It's hard!!! Come on, make the old lady move slower... It gets boring if its this hard... especially since (IMO) this game is based on luck rather than skill at these speeds...

Link to comment
Share on other sites

Excellent idea! Not that I understood any of the dialogue by Petra...

It's hard!!! Come on, make the old lady move slower... It gets boring if its this hard... especially since (IMO) this game is based on luck rather than skill at these speeds...

You are back at last

Link to comment
Share on other sites

Hello

Nothing is impossible for a programmer :)

Global $PAUSE = False
HotKeySet("{PAUSE}","_pause")
$wg = WinGetPos("Kill Petra!")
If @error Then Exit
While 1
    Sleep(100)
    If $PAUSE Then ContinueLoop
    $px = PixelSearch($wg[0], $wg[1], $wg[0] + $wg[2], $wg[1] + $wg[3], 0xD4D0C8)
    If @error Then ContinueLoop
    ConsoleWrite($px[0]&","&$px[1] & @CRLF)
    MouseClick("LEFT",$px[0], $px[1], 1,1)
WEnd

Func _pause()
    $PAUSE = Not $PAUSE
EndFunc

Mfg/Best Regards Spider

www.AutoIt.de - Moderator of the German AutoIt Forum

 

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...