commit 1a56623ba211e06c74052028ebd003512ac20227 Author: Philipp Horstenkamp Date: Sat Apr 9 17:42:35 2022 +0200 init diff --git a/main.mjs b/main.mjs new file mode 100644 index 0000000..d6f535d --- /dev/null +++ b/main.mjs @@ -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]); + } + } +} \ No newline at end of file