This commit is contained in:
Philipp Horstenkamp 2022-04-09 17:40:30 +02:00
commit f23eae8833
Signed by: Philipp
GPG Key ID: DD53EAC36AFB61B4
1 changed files with 11 additions and 0 deletions

11
main.mjs Normal file
View File

@ -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);
}
}