View Single Post
  #14  
Old 02-17-2009, 09:07 PM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
reviving this thread for questions relating to A*.

I'm working on a script right now (only in testing phase, mostly consists of comment lines planning out what I'm doing). I've done what the tutorial you provided tells me; divided the area into a grid --I'm using 2x2 grid, the size of block.png-- checking clockwise starting from the right and only looking at the up/down - left/right squares. When the NPC finds a square that fits the criteria (in my case a grid that has 4 of the specific tiles I'm looking for) it'll move towards that square, and mark the previous square checked so it won't get stuck in a loop (while I'm on this subject, how do I add variables to an array without clearing the previous?) I'm using replacestring to keep track of this, and I don't believe I need to). My question; is there a more efficient way of checking what tiles are around me other than:

"Grid 1 check... to the right - [one x away, one y away], [two x away, two y] [away, one x away, two y away], and two x away, and one y away]" - if return negative then
"Grid 2 check... below -[one x away, one y away], [two x away, two y] [away, one x away, two y away], and two x away, and one y away]" SO ON AND SO FORTH.

I am writing a function for each grid check, so I am writing for different things. Can I condense this?
__________________
Save Classic!
Reply With Quote