And again.

_Hopefully_ I ironed out the bugs out of this one. The most significant change is that the main game loop has been somewhat altered. The latter half of the functions above are now called at a different time within some of the other functions so that the order now is close to:

get keypress
player moves
“generate view” called
find visible entities on screen by worldcoords, set their current x,y values
set on scentmap which tiles are blocked by entities or wall tiles
floodfill from the player’s position a scent
for each entity that is on screen:
..take a turn: decide where to move by finding higher scent value
..set tile entity is on to “not blocking”
..”move” -> check new tile’s blocking status, if clear: set world coords and screen coords
..set this new tile to a status of ‘blocking’

Essentially I’m trying to bring the loop down to “player takes a turn -> entity takes a turn -> entity takes turn -> repeat”, and that has crushed most of the bugs I’ve discovered. I think what my problem was, was that the flood fill and scent maps were lagging and causing the problems. Oh well, should be good now.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: