GGJ Archives 2009-2012

Commanding instead of guiding


I wasn't convinced of the way in which I moved the patrols around the screen using paths / segments. It felt very inflexible. For instance, how to tell the guard to wait between two path's segments and "scan" the room? Not easy with path, so I scratched that method.

What I use now is "commands". That is, instead of marking the path on the floor (figuratively) and let the guard follow the trail, I now tell the guard: move 5 units to the left, wait, rotate to the left, move down, etc. Actually, it fells much like an "scripting language" inside the C++. For instance:

std::vector commands;
commands.push_back(new Move(LEFT, 5));
commands.push_back(new Wait(0.5f));
commands.push_back(new Move(DOWN, 3));
commands.push_back(new Wait(0.7f));
commands.push_back(new Move(UP, 3));
commands.push_back(new Wait(0.5f));
commands.push_back(new Move(RIGHT, 5));

I let you guess what this guard does. Of course, when the last command is finished, it returns to the beginning.


All rights reserved 2012-2013, Global Game Jam