Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Sarven Sentry Help Required


I have been play code combat for around 2 weeks and I am unfortunately stuck on Sarven Sentry. Could anybody help me please.

My Code -
flagGreen = self.findFlag(“green”)
flagBlack = self.findFlag(“black”)
flagViolet = self.findFlag(“violet”)

if flagGreen:
    if flagGreen.colour is "green":
        self.buildXY("fence", flagGreen.pos.x,

if flagBlack:
    if flagBlack.colour is "black":
        self.buildXY("fire-trap", flagBlack.pos.x, flagBlack.pos.y)
if flagViolet:
    if flagViolet.colour is "violet":
        self.moveXY(flagViolet.pos.x, flagViolet.pos.y)

My hero just can’t move. Help Pls.


You can either pass a color to findFlag like flagGreen = self.findFlag("green"), which is the approach the sample code takes, or you can find a single flag and then check its color, whcih seems to be what you have added. Either works, but you don’t need both. The reason it’s not working is that you put flagGreen.colour instead of flagGreen.color–we are American so we have the variables named after the American spelling! So try taking that secondary color check out, or at least using the American speling, and you should be good to go to find the flags. The other thing is that you need to pass flagGreen to pickUpFlag instead of "green".


thx bra ur da best
btw i got pass