Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / sprite travel path around objects

Author
Message
Deion
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 1st Sep 2011 21:31
been trying to figure out whats the best way to have a sprite go from one location to another but avoid objects in there path, go around.. without waiting to bump into it..... any ideas?

Cheers,
Deion G.
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 1st Sep 2011 23:14
Have a Google for A* pathfinding. There's loads of examples in all sorts of languages, so you'll probably be able to find one that you can both understand and convert to AGK.
Deion
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United States
Posted: 2nd Sep 2011 02:55
well, ive got one sort, and i have code in c++ already that will do this, problem is i dont know this version of basic language well enough. not very much in the way of documntation. is nothing like visual basic, so thats not the problem at all... ive tried converting my c++ code to this and thats were my problems are..

Cheers,
Deion G.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 5th Sep 2011 05:02
Coding this from scratch is not that easy, and it entirely depends on the complexity of the obstacle. If for example you know the obstacle is only ever a single circle, then you can do something quick and cool like detecting when the object is within the radius of the circle, then plotting a new path to skim the edge of that circle and then a second point to the original destination (using a simple state machine). I am sure a fellow AppGameKit user can knock up a simple example of this to get you started thinking about the intricate world of path-finding!

I drink tea, and in my spare time I write software.

Login to post a reply

Server time is: 2024-11-21 16:50:14
Your offset time is: 2024-11-21 16:50:14