From f23eae8833fd74104efa94283a3108da58fabea9 Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Sat, 9 Apr 2022 17:40:30 +0200 Subject: [PATCH] init --- main.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 main.mjs diff --git a/main.mjs b/main.mjs new file mode 100644 index 0000000..f57b471 --- /dev/null +++ b/main.mjs @@ -0,0 +1,11 @@ +import { getObjectsByPrototype, findClosestByPath } from '/game/utils'; +import { Creep, Flag } from '/game/prototypes'; + +export function loop() { + var creeps = getObjectsByPrototype(Creep).filter(i => i.my); + var flags = getObjectsByPrototype(Flag); + for(var creep of creeps) { + var flag = creep.findClosestByPath(flags); + creep.moveTo(flag); + } +} \ No newline at end of file