Can't get past Endangered Burl PLEASE HELP

It is attacking the burl because “type burl” isn’t checking to see if it is a burl or not. Could you post the complete code with formating again so I can take a look and see if it is an indenting problem?

1 Like

Too bad it 00:10 am here , really want to help but have to sleep , so here some suggestion

combine your first code with the 2nd one , you have removed enemy.type so make it back but don’t forget to keep enemy = findnearsttenemy ,

1 Like

enemy.type is "burl": perhaps? :slight_smile:

the ‘is’ needs to be in there.

the third level on the second map

    enemy = self.findNearestEnemy()
    
        
    
    if enemy.type is "burl":
        self.say("I'm not attacking that Burl!")
    
       
    if "type munchkin":
          self.attack(enemy)
    
    if "type thrower":
          self.attack(enemy)
    
    if "type ogre":
        self.moveXY(41, 37)

Help pease it still isn’t working and I don’t understand

what you guys want me to do

OK, you changed the “type burl” thing to

if enemy.type is "burl":

which is good… change the others as well

1 Like

it is just putting an red x under my character but not donig any thing or saying what is wrong my cod I have so far is:

enemy = self.findNearestEnemy()

    

if enemy.type is "burl":
    self.say('I am not attacking that Burl!')

   
if enemy.type is "munchkin":
      self.attack(enemy

if enemy.type is "thrower":
    self.attack(enemy)

if enemy.type is 'ogre':
    self.moveXY(41, 37)

Ok… is your loop in there somewhere?

2 Likes

no where do I put it

Loops generally go in the beginning of your code… so try:

loop:
    enemy = self.findNearestEnemy()
    THE-REST-OF-YOUR-CODE-GOES-HERE
1 Like

does the rest of my code have to have four spaces infront of it

You will have to watch the tabs carefully here, and I don’t want that to trip you up so it should look something like this:

loop:    
    enemy = self.findNearestEnemy()



    if enemy.type is "burl":
        self.say('I am not attacking that Burl!')


    if enemy.type is "munchkin":
        self.attack(enemy

    if enemy.type is "thrower":
        self.attack(enemy)

    if enemy.type is 'ogre':
        self.moveXY(41, 37)
1 Like

it worked tank you sooooooooooooooooooooooooooooooooooooooo much you are my hero =) =0 thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you

I ran your code successfuly after fixing a small parenthesis error. I would recommend going back and reviewing loops and if/else statements before continuing. They are used a whole lot.

2 Likes

Good luck! It was no trouble. If you need anything else post it up, but I am off for the evening. G’night!

1 Like

Thank you! :grinning:

lol…

loop:
    self.say("You're welcome")
6 Likes

Hey guys. I think this is a glitch. When I press,

if (enemy.type == "thrower") {
    this.attack(enemy);

}
It won’t attack the archers. Is it a glich or no.]
Thx,