After a couple of months trying different things, just now I’ve killed the two towers twice on a row, in nearly 40 seconds; then my flag does no longer work, Aryn no longer obeys my flag and just walks straigth on a loop; the making of new griffin-riders does no longer work, etc. Besides, Aryn gets frozen more than 75% of the time. The flag no longer works, and I’ve tried passsing this more than 50 times. My code is more than enough to get passed Summit’s Gate. I’ve gotten to the very end killing all but the beam towers to avoid getting FROOOOOZZZZEEENNN over and over and over and over and over again; and got frozen when I came back to take the towers. Is this game supposed to work like this?
My code works really well so I don’t know if I can post it here. On the other hand, I don’t know what else to do.
If there is a lot of computation, the code will get laggy and the flags will not respond.
Besides, you cannot trust flags too much because they are produced by humans. Humans are weak and they will mess the flags on the next play. Machines are strong and they will conquer all in due time
Hard code your flags: once you find that a order works, hard-code it so you will not have to put that flag again:
// these tell you at what phase you are inside the level
var level_phase=0;
var next_flag=0;
// once you find that works, edit your code and put it automatically
var flags=[ {x:10,y:20}, {x:30,y:50},{x:100,y:50}];
//this is your coded flag
var red_flag=false;
var red_flag_pos=null;
//this function is the "brain" of the level.
//takes care of everything that is level specific
this.levelPlan = function(level_phase, next_flag){
// decide when to throw the next flag:
if(catapults.length==0) //all enemies killed
if(this.now()>35) // some time passed
if(this.distanceTo(warlock)) //near a enemy
if(tower.health<0) // some enemy is dead
// combine this with level_phase also:
if(level_phase==0 && catapults.length==0){
level_phase++;
enemy=this.findNearest(this.findByType("door"));
red_flag=true;
red_flag_pos=flags[next_flag];
next_flag++;
..................
};
and in the main loop:
if (red_flag){
this.moveXY(red_flag_pos.x, red_flag_pos.y);
// "pick up" the red flag
red_flag=false;
}
Disclaimer: this code is written in 5 minutes, and not tested
I am really interested in this. But I don’t quite understand how it works.
Could you flesh out a bit? Here is how I translated this into python:
levelPhase = 0
flagindex = 0
# an array of wayward points
flags={}
# have we arrived at this flag?
flagCleared= False
#nextFlag stores the coordinats of your flag
nextFlag = null
def levelPlan (levelPhase, flagIndex):
if len(catapults) == 0:
pass
if self.now()>35:
pass
if self.distanceTo(warlock):
pass
if tower.health <0:
pass
# this means we are ready to take down the door
if levelPhase==0 and len(catapults) == 0:
levelPhase+=1
door = self.findNearest(self.findByType("door"))
flagCleared = False
flagIndex +=1
nextFlag = flags[flagindex]
while levelPhase<4:
levelPlan (levelPhase, flagIndex)
if not flagCleared:
self.moveXY(nextFlag.x, nextFlag.y)
flagCleared=True
levelPhase+=1