You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

11 lines
421 B

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