This commit is contained in:
Philipp Horstenkamp 2022-04-09 17:42:35 +02:00
commit 1a56623ba2
Signed by: Philipp
GPG Key ID: DD53EAC36AFB61B4
1 changed files with 22 additions and 0 deletions

22
main.mjs Normal file
View File

@ -0,0 +1,22 @@
import { getObjectsByPrototype } from '/game/utils';
import { Creep, Flag, StructureSpawn } from '/game/prototypes';
import { MOVE } from '/game/constants';
var creep1, creep2;
export function loop() {
var mySpawn = getObjectsByPrototype(StructureSpawn)[0];
var flags = getObjectsByPrototype(Flag);
if(!creep1) {
creep1 = mySpawn.spawnCreep([MOVE]).object;
} else {
creep1.moveTo(flags[0]);
if(!creep2) {
creep2 = mySpawn.spawnCreep([MOVE]).object;
} else {
creep2.moveTo(flags[1]);
}
}
}