Jump to content

Close a moving window?


Recommended Posts

I cant get this gui to close... why?

#include <GuiConstants.au3>
    ;up-down
$y=MouseGetPos(1)
    ;left-right
$x=MouseGetPos(0)+ 150
GuiCreate("zombie", 115, 165,$x, $y , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Pic_1 = GuiCtrlCreatePic("zombie.bmp", 0, 0, 120, 170)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case Else
        ;;;
EndSelect
$XMov=MouseGetPos(0)
    $YMov=$y + 10
    WinMove("zombie","",$Ymov,$XMov)
    Sleep(1000)
    $YMov=$y - 10
    WinMove("zombie","",$Ymov,$XMov)
    Sleep(1000)
    $YMov=$y - 10
    WinMove("zombie","",$Ymov,$XMov)
    Sleep(1000)
    $YMov=$y + 10
    WinMove("zombie","",$Ymov,$XMov)
WEnd
Exit

[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]

Link to comment
Share on other sites

#include <GuiConstants.au3>
HotKeySet("{Esc}", "_GetBiggerGun") ; it's a timing issue

;up-down
$y = MouseGetPos(1)
;left-right
$x = MouseGetPos(0) + 150
GUICreate("zombie", 115, 165, $x, $y, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Pic_1 = GUICtrlCreatePic("zombie.bmp", 0, 0, 120, 170)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case Else
            $XMov = MouseGetPos(0)
            $YMov = $y + 10
            WinMove("zombie", "", $YMov, $XMov)
            Sleep(1000)
            If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
            $YMov = $y - 10
            WinMove("zombie", "", $YMov, $XMov)
            Sleep(1000)
            If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
            $YMov = $y - 10
            WinMove("zombie", "", $YMov, $XMov)
            Sleep(1000)
            If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
            $YMov = $y + 10
            WinMove("zombie", "", $YMov, $XMov)
    EndSelect
WEnd

Func _GetBiggerGun()
    Exit
EndFunc   ;==>_GetBiggerGun

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

oooh.... thanks!

have I ever mentioned that you and gafrost practically solve every one of my carelessness scripting problems?

EDIT: oops, you ARE gafrost =P

Edited by MethodZero

[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]

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