This commit is contained in:
Philipp Horstenkamp 2022-04-09 17:35:08 +02:00
commit 132e01e90b
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 } from '/game/utils';
import { Creep } from '/game/prototypes';
import { ERR_NOT_IN_RANGE } from '/game/constants';
export function loop() {
var myCreep = getObjectsByPrototype(Creep).find(creep => creep.my);
var enemyCreep = getObjectsByPrototype(Creep).find(creep => !creep.my);
if(myCreep.attack(enemyCreep) == ERR_NOT_IN_RANGE) {
myCreep.moveTo(enemyCreep);
}
}