forums

TNT Basic Forums > Programming Q&A
A star
< Last Thread     Next Thread >
Author
Thread        Post A Reply

08-25-2003 14:44

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

I was wondering if anyone made a A star algorythm for TNT basic. ( If you don,t know, the A star algorythm allows the computer to find a path in a maze, or a level )

08-25-2003 19:34

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

If you are talking about randomly generated mazes, this may be difficult and I don't think anyone has done this in TNT yet. The simplest way of doing it is to use a hit-and-miss mass of if statements and collision detection e.g:

repeat
if wall_not_hit=true
'Code to move sprite either side here
if wall_not_hit=false
'Code to move sprite up here 'Try other direction instead
end if
else if wall_not_hit_false 'Player has walked into something
'and so on
end if
until escaped=true

but if you have pre-loaded maps that aren't randomly generated you can cheat and use an array or text file to store the necessary directions to move the sprite.

GOOD LUCK!
Mark_667

08-25-2003 23:53

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

too bad! I've already done pretty good hit-and-miss A.I. in my upcoming game, but I think people who know how to use A star are already using C++...

08-26-2003 14:32

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

More info

More info about A* can be found herehttp://theory.stanford.edu/~amitp/GameProgramming/ :-)

08-26-2003 15:10

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Thanks!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.