bass711 Posted February 7, 2009 Share Posted February 7, 2009 How you write a code if i dont want a pixel to collide with other for example the walls are green color the ball is red i dont want the red ball to collide with walls x.y if the ball is near to left send {rigth}, using key arrows any help pleaseeee any dimension 500,500,500 thank you Link to comment Share on other sites More sharing options...
BrettF Posted February 7, 2009 Share Posted February 7, 2009 Hi, Post your code. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
bass711 Posted February 7, 2009 Author Share Posted February 7, 2009 Well I hope you dont laugh about my code im still newbie im trying to learn by making projects and the best way to do it is with games so now i want my car to drive solo accelerate button is up {up} key move car left and right the color of the road is gray and on left and right sides is green walls I come up with the idea of my car avoiding the green color and stay on the road, in other way is by timing the send keys when to turn left rigth up, and down, but for everytrack it will take a long time for me to do it. so here is my code please help $color =0x89881F;green color obj walls $color1 = 0xF30606;red color obj car $coord = PixelSearch( 0, 0, 1023, 651, $color, 10, 20) If IsArray($coord) = 1 Then send('{up}') ;<===this is for accelerate obj = car Sleep(300) EndIf $coord1 = PixelSearch( 0, 0, 1023, 651, $color1, 10, 20) If IsArray($coord1) = 1 Then Send('{right}'); or left or up or down this where im lost how tell the code go to the opositive side Sleep(300) EndIf Link to comment Share on other sites More sharing options...
bass711 Posted February 8, 2009 Author Share Posted February 8, 2009 Heeeeeeeelp oh man i will keep reading . Link to comment Share on other sites More sharing options...
TerarinK Posted February 8, 2009 Share Posted February 8, 2009 First off your viewing is to great, your should find a focus point. 1st person then a single beam, 3rd person then you are in a car focusing it on a single beam. It you moving in a straight line you can accomplish this more easily if you choose a closer range 0,0,5,5 compared with 0,0,1000,600 If you are in 1st person then can you see what side is open, to take? If you do then make a quite search on those two spots. 3rd person is easier for you because you can easily check to see what side is open and then send right or left $asColors = StringSplit("0x89881F|0xF30606", "|") While 1 Send("{up down}") While 1 For $sColor In $asColors $aiCoords = PixelSearch(0, 0, 1023, 651, $sColor, 10, 20) If IsArray($aiCoords) Then Send("{right}") ExitLoop EndIf Next WEnd WEnd Just wanted you to ask you are the objects both obstacles or are you the car? Why, do you want it to skiip once every 20 on your pictures, I know 2 4 maybe 8 at the max unless this is some preschool kids game. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
bass711 Posted February 8, 2009 Author Share Posted February 8, 2009 well im doing this just to learn autoit i can just drop this test in move on with next but i really want to figure how to do iti know a way to do it wich is by sending the arrow keys by time delay but i need to track each curve exactly this a hard way the otherway is to make the pixels not to collide since the accelerate key is up all i have to figure is when to turn right or left there is only 3 keys to control the car up , left and right for example if the car is getting really close to the right wall send a commando to be away for 20 pixels from the car by sending left key or the other way here is a pic of example srry for my art and thanks for your help. Link to comment Share on other sites More sharing options...
TerarinK Posted February 8, 2009 Share Posted February 8, 2009 Does the car turn on a dime or like some delay in there or even have to turn it like a real car and turning to much can cause you to overturn and then reversing all of a sudden. If it is like a dime is is pretty easy. Is your vehicle always in the center of the screen, if not then that is the first thing and you need to find the exact size of the car so your not searching the entire screen. Then put a [3 wide] [25 long] line going out the front. If it encounters a wall then fall into another pixelsearch searching the left and right. Now it is up to you as your could search left/right or right/left and whatever you find first send the key to turn that way. Else you could calculate both and it both a open have it decide on what way to go. Then have it pass out and fall back to the 3 wide 25 long line again coming out the front 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
bass711 Posted February 8, 2009 Author Share Posted February 8, 2009 (edited) it stays on the center but yea it turns 360 degree left or right is simular to this game linkis a top view game Edited February 8, 2009 by bass711 Link to comment Share on other sites More sharing options...
jpam Posted February 8, 2009 Share Posted February 8, 2009 Try prospeed.dllit has all the tools you want to easy build your game.http://www.autoitscript.com/forum/index.ph...amp;hl=prospeed Link to comment Share on other sites More sharing options...
BrettF Posted February 8, 2009 Share Posted February 8, 2009 I thought he was botting a game? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
bass711 Posted February 8, 2009 Author Share Posted February 8, 2009 I thought he was botting a game?You are correct and I think pixelsearch is out of the question I have to figure out by timing keys is the only way 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