BillLuvsU Posted May 2, 2005 Share Posted May 2, 2005 Ok, I am making a game and i need a function to tell if a picture in a gui is touching the color black (0xffffff). To be more descriptive i am outlining all borders of objects that cannot be walked through with black so that the picture cannot move through them. So black basically means wall. [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
layer Posted May 2, 2005 Share Posted May 2, 2005 I don't know if that's possible... I may be wrong, but what about setting limits on there X/Y coords? FootbaG Link to comment Share on other sites More sharing options...
Ejoc Posted May 2, 2005 Share Posted May 2, 2005 There are DLL functions dealing w/ rectangle detection:http://msdn.microsoft.com/library/default....ctangl_1mcz.aspw/ the beta AutoIt you could use these functions. Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
BillLuvsU Posted May 2, 2005 Author Share Posted May 2, 2005 (edited) ok,got it! include<"guiconstants.au3"> global $picx = 195, $picy = 190 guicreate( "Test" , 400 ,400 ) guictrlcreatepic( "pic.bmp", $picx , $picy, 10, 20 ) guictrlcreatepic( "black.bmp", 100, 10, 10, 380 ) while 1 ;insert functions to move pic.bmp here. $collision = _CollisionDetect( $picx - 1, $picy - 1, $picx + 11, $picy + 21, "0xffffff" ) wend Func _CollisionDetect $pixel = PixelSearch( $picx - 1, $picy - 1, $picx + 11, $picy + 21, "0xffffff" ) if @error then Return 0 ElseIf $pixel[0] = $picx - 1 then return 1 ElseIf $pixel[1] = $picy - 1 then return 2 ElseIf $pixel[1] = $picy + 21 then return 3 ElseIf $pixel[0] = $picx + 11 then return 4 Endif EndFunc;==>_CollisionDetect Havn't tested it cause im at school but should work... Edited May 2, 2005 by fear1313 [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw 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