LithiumLi Posted March 3, 2009 Share Posted March 3, 2009 (edited) Hello I have a GUI with two shapes and when those shapes touch I want it to do a function although I don't want to have it detecting it by using positions if possible since these objects will be moving randomly. I would also like it to not flicker while moving. HotKeySet("{RIGHT}" , "_Move") #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Test", 300, 100) $Graphic1 = GUICtrlCreateGraphic(0, 0, 100, 100) GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x00FF00) $Graphic2 = GUICtrlCreateGraphic(200, 0, 100, 100) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFF0000) GUISetState(@SW_SHOW) $Move = 0 While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Move() $Move = $Move +10 GUICtrlSetPos($Graphic1 , $Move , Default) EndFunc Edited March 3, 2009 by LithiumLi Link to comment Share on other sites More sharing options...
qazwsx Posted March 3, 2009 Share Posted March 3, 2009 The only way i could think to do it without knowing the position is to use pixel functions to see when they over lap, but that seems like a terrible idea. If you are moving them, then you know the position. Link to comment Share on other sites More sharing options...
LithiumLi Posted March 3, 2009 Author Share Posted March 3, 2009 The only way i could think to do it without knowing the position is to use pixel functions to see when they over lap, but that seems like a terrible idea. If you are moving them, then you know the position.I guess I can read my random return value and just add/subtract seems like best method.Thanks 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