mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
Action attack_dir(): Implement, trivially random now
This commit is contained in:
parent
0398856635
commit
0c29808836
5 changed files with 36 additions and 0 deletions
|
@ -72,6 +72,13 @@ connection::actions(class agent &agent)
|
|||
if (y < -1) y = -1; if (y > 1) y = 1;
|
||||
if (!agent.move_dir(x, y))
|
||||
bump();
|
||||
} else if (!cmd.compare("attack_dir")) {
|
||||
int x = 0, y = 0;
|
||||
sscanf(line.c_str(), "%d %d", &x, &y);
|
||||
if (x < -1) x = -1; if (x > 1) x = 1;
|
||||
if (y < -1) y = -1; if (y > 1) y = 1;
|
||||
if (!agent.attack_dir(x, y))
|
||||
bump();
|
||||
} else {
|
||||
std::cout << "unknown line " << cmd << " " << line << " ...\n";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue