hello
I have spend lot of time to unsderstand A* algo !! for path fiding !
I code this ( not optimised lol , to tired for remake it !! )
for lovequest !
mouse left + s = Place start
mouse left + e = Place End
mouse left for draw wall !
Space for run algo !
r for restart
b y !
Pieuff ! A* PathFinding kill me !
Pieuff ! A* PathFinding kill me !
- Attachments
-
- Pathfinding.love
- (1.59 KiB) Downloaded 244 times
- TechnoCat
- Inner party member
- Posts: 1612
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Pieuff ! A* PathFinding kill me !
I can place all the walls and set the start and end point, but I don't see any paths being found?
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Pieuff ! A* PathFinding kill me !
It's really hard to see what you're doing since the walls don't show.
Help us help you: attach a .love.
- TechnoCat
- Inner party member
- Posts: 1612
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Pieuff ! A* PathFinding kill me !
The walls show on mine, it draws a rectangle for when you click. But when I press space I get a LOVE error.Robin wrote:It's really hard to see what you're doing since the walls don't show.
Edit: I got it to do stuff. You just have to move it out from the edge. Apparently it checks outside the screen and results in a nil value.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Pieuff ! A* PathFinding kill me !
See, if I could figure this out too I'd put mouse control in my game as well.
Re: Pieuff ! A* PathFinding kill me !
Hmm, that's neat. I've had some success with my own a* pathfinding implementations, although it's cool to see what it's outputting other than just the path.
Also, there's one thing that seems to be missing: if there is no valid path, your algorithm currently locks up in a while loop.
You have to add something so that if the "open list" is empty, it gives up (every tile that can be reached, has been reached).
Oh yeah, and as TechnoCat pointed out, you ought to check if the x and y of a spot is on the screen when you're checking if it's walkable
Your code confuses me as to which language you speak; all of the functions and variables seem to be english words, yet the comments are french.
Also, there's one thing that seems to be missing: if there is no valid path, your algorithm currently locks up in a while loop.
You have to add something so that if the "open list" is empty, it gives up (every tile that can be reached, has been reached).
Oh yeah, and as TechnoCat pointed out, you ought to check if the x and y of a spot is on the screen when you're checking if it's walkable
Your code confuses me as to which language you speak; all of the functions and variables seem to be english words, yet the comments are french.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 0 guests