Made some graphics for the blobby dudes.
The rest of what I’ve been working on isn’t really apparent at this point. I hooked up a state machine with a full complement of AI states; actbusy, aggro, engage, evaded, and cooldown. These guys only have behavior defined for actbusy, so they’ll hop around aimlessly no matter whether I get into their fields of view.
Here’s the current blob AI:
set var direction 1
state "act busy"
{
set var wallLeft World:checkWall -20 0
set var wallRight World:checkWall 20 0
set var floorLeft World:checkWall -20 16
set var floorRight World:checkWall 20 16
set var ceiling World:checkWall 0 -16
set direction match [wallLeft wallRight]
{
case [false true] -1
case [true false] 1
case [false false] direction
case [true true] 0
}
if ! floorRight { if ! wallRight { set direction 0 } }
if ! floorLeft { if ! wallRight { set direction 0 } }
if ceiling { set direction 0 }
Mover:hop direction
ifelse == direction 0
{ stateSleep chooseFrom [1 1.2 1.1] }
{ stateSleep chooseFrom [0.5 0.7 0.6] }
}
Basically, all it’s doing is first checking a series of positions around the blob to see if it can find a platform. If there’s a wall to the right, it hops left, and vice versa. If there’s no adjacent wall, it continues in the direction it was moving last. If there’s no floor where it would hop, it just bounces in place.
Simple, but effective so far.