Simplify random walk routine

This commit is contained in:
2014-06-19 08:15:17 -07:00
parent 927842ab61
commit 535953a245
2 changed files with 2 additions and 26 deletions

View File

@@ -12,18 +12,10 @@ This stuff is just for me to keep track, since I'm afraid using GitHub's issue t
The AI should, in their default states, wander around the map aimlessly. They should restrict themselves to normal pedestrian traffic lanes, which will likely require the marking of such lanes in TilED. The AI should, in their default states, wander around the map aimlessly. They should restrict themselves to normal pedestrian traffic lanes, which will likely require the marking of such lanes in TilED.
## TODO : AI that chases you on the map
There needs to be 2 classes of AI : AI that runs from you, and AI that chases you. At this point the "run from you" AI should just continually try to escape you. The "chase you" AI should continually try to reach you.
## TODO : "Run away" AI reports you to "Chase" AI types ## TODO : "Run away" AI reports you to "Chase" AI types
The "Run Away" AI type should continue running away until it finds a "Chase" AI type to report you to, or until a certain amount of time has passed since the last time they saw you The "Run Away" AI type should continue running away until it finds a "Chase" AI type to report you to, or until a certain amount of time has passed since the last time they saw you
## TODO : "Chase" AI should lose track of you after a certain time
The Chase AI should stop chasing you if it has not seen you for a certain amount of time
## TODO : "Chase" AI should actively "look" for you after it loses you, for a certain amount of time ## TODO : "Chase" AI should actively "look" for you after it loses you, for a certain amount of time
See above, once the Chase AI loses you, it should look for you for some time before giving up See above, once the Chase AI loses you, it should look for you for some time before giving up

View File

@@ -1072,24 +1072,8 @@ var AISprite = function(game, x, y, key, frame) {
} }
if ( game.rnd.integerInRange(0, 100) < 95 ) if ( game.rnd.integerInRange(0, 100) < 95 )
return; return;
switch ( game.rnd.integerInRange(0, 4) ) { this.turnUnseenDirection();
case 0: { setMovingState(this, this.state | STATE_MOVING);
newstate = newstate | (STATE_FACE_RIGHT | STATE_MOVING);
break;
}
case 1: {
newstate = newstate | (STATE_FACE_LEFT | STATE_MOVING);
break;
}
case 2: {
newstate = newstate | (STATE_FACE_UP | STATE_MOVING);
break;
}
case 3: {
newstate = newstate | (STATE_FACE_DOWN | STATE_MOVING);
}
}
setMovingState(this, newstate);
} }
this.update = function() this.update = function()