Minikori Posted August 24, 2008 Share Posted August 24, 2008 Just trying to make the icon go to the mouse position whenever it left button is clicked, but every time I click, it disappears. Help please? Here's the code: #include <GUIConstants.au3> #include <Misc.au3> $Main = GUICreate("TestGame", 400, 400) $Player = GUICtrlCreateIcon(@WindowsDir & "\cursors\dinosaur.ani", -1, 20, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf If _IsPressed(01) Then Go() EndIf WEnd Exit Func Go() $MousePos = MouseGetPos() GUICtrlSetPos($Player, $MousePos[1], $MousePos[0]) EndFunc For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 24, 2008 Share Posted August 24, 2008 You have the $MousePos indexes switched. Fix that first and see if it works. Link to comment Share on other sites More sharing options...
Minikori Posted August 24, 2008 Author Share Posted August 24, 2008 You have the $MousePos indexes switched. Fix that first and see if it works.Tried that. Didn't work. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 24, 2008 Share Posted August 24, 2008 Whether you tried it or no, [0] = x and [1] = y. You need to get them correctly. You also need Opt("MouseCoordMode", 2). Link to comment Share on other sites More sharing options...
Minikori Posted August 24, 2008 Author Share Posted August 24, 2008 Whether you tried it or no, [0] = x and [1] = y. You need to get them correctly. You also need Opt("MouseCoordMode", 2).Alright it's fixed, thank you! For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
rasim Posted August 24, 2008 Share Posted August 24, 2008 MinikoriEasy way:#include <GUIConstants.au3> $Main = GUICreate("TestGame", 400, 400) $Player = GUICtrlCreateIcon(@WindowsDir & "\cursors\dinosaur.ani", -1, 20, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN Go() EndSwitch WEnd Func Go() $MousePos = GUIGetCursorInfo() GUICtrlSetPos($Player, $MousePos[0], $MousePos[1]) EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now