New Level: Endangered Burl


#1

Check it out here. We created this level as a way to ramp up to the significantly harder Thornbush Farm. What we’re most interested in is whether this and Village Guard are a better way to introduce players to if/else than simply throwing people into Thornbush.


#2

Hello guys, found bug on this level, take a look on a screen attached.


#3

This level has a bug. For some reason the code below makes me attack the Burl.
loop:
enemy = self.findNearestEnemy()
if enemy.type is “ogre”:
self.moveXY(28, 47)
self.moveXY(20, 20)
elif enemy.type is “burl”:
self.say(“Nearest enemy is a burl.”)
else self.attack(enemy)


#4

@Serhii_Hrabas Looks like 1) you need a colon after your line 15 and 2) we have a bug with our error messages! I’ve added this to our list.

@robert_peetsalu You should be getting an error message from your else? It needs a colon after it, too. Although it shouldn’t be making you attack the burl, it’s probably breaking in some weird way from the invalid else syntax.


#5
loop:
    enemy = self.findNearestEnemy()
    
    # Remember: don't attack type "burl"!
    if enemy.type is "burl":
        self.say("I'm not attacking that Burl!")

    # The "type" property tells you what kind of creature it is.
    if enemy.type is "munchkin":
        self.attack(enemy)
    
    # Use "if" to attack a "thrower".
    if enemy. type is "thrower":
        self.attack("thrower")    
    # If it's an "ogre", run away to the village gate!
    if enemy. type is "ogre":
        self.moveXY(40, 47)

#6

That looks good, except don’t put spaces in between enemy. type. Just use enemy.type.


#7

is this good

loop:
    enemy = self.findNearestEnemy()
    
# Remember: don't attack type "burl"!
if enemy.type is "burl":
    self.say("I'm not attacking that Burl!")
# The "type" property tells you what kind of creature it is.
if enemy.type:"munchkin"
    self.attack(enemy)
    # Use "if" to attack a "thrower".
if enemy. type is "thrower":  
    self.attack("thrower")
# If it's an "ogre", run away to the village gate!
if enemy. type is "ogre":
    self.moveXY(40, 47)

#8

I used that but it says enemy is undefined?


#9

All your code needs to be indented so that it’s part of the loop.

if enemy.type:"munchkin" should have if enemy.type is "munchkin" instead of the colon.


#10

i have this and i indented but it still says error on line 2 undefined is not an action.

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)

#11

enemy is also indented


#12

You may not have glasses with findNearestEnemy equipped?


#13

Actually i used this. it was the correct answer