Endangered Burl


#1

I have spent hours on this level, and cannot figure it out, it says the name “thrower” isn’t correct. Please help me. Thanks allot


#2

Not sure how you’re trying to use it but

(enemy.type == “thrower”)

works.


#3

Thanks allot, i was just trying “thrower” or thrower.


#4

It’ not working either where did you put it on the code page @jwrobbs


#5

Forgot to mention that I’m using Javascript. Don’t know what you are using.

That is an example condition statement from my code. I believe that one was from an if statement.


#6

Maybe @jwrobbs. I might have possibly put it in the wrong spot on the coding area… where did you put yours?


#7

What language are you using?


#8

@TBgamer14 , What language are you using? That is what @jwrobbs is asking, Python, Javascript, CoffeeScript, etc.

@jwrobbs is correct if you are looking into JavaScript but if you are not using that language it will not work.

(Not sure if this Topic is still active.)

But if you are using Python (Default and most likely if Java is not working)
Here is what he is saying but in Python

if enemy.type is “thrower” :
self.attack(enemy)


#9

Also, if you are still having struggles i’ll show you the parts in Python if need be.


#10

I’m not sure what type I’m using but self.attack(“thrower”) wasn’t working. @ItsLastDay and @jwrobbs however when I used the JavaScript code, it didn’t attack the throwers, but it didn’t say the code was wrong


#11

Python is what self.attack(“thrower”) is for. That will work.


#12

That didn’t work so I think I’m using JavaScript


#13

You cannot do self.attack("thrower") You must do this:

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

#14

Oh yea, forgot about that part facepalm

@TBgamer14 well, if you are still wanting to use python then you need to type in


#15

Is this code lined up it keeps telling me to ine the code up plase Reply.

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)

#16

If you use and tags it is much easier to share your code

Basically after each if line you need to indent the line that follows it. All if statements should be aligned (in this case).

That said, I see a couple issues with your code:
Your if statement for munchkins is slightly off, and for throwers and ogres you added a space to enemy.type.


#17

I’d try the code listed below study it or copy and paste it:

Only attack enemies of type “munchkin” and “thrower”.

Don’t attack a “burl”. Run away from an “ogre”!

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(enemy)
# If it's an "ogre", run away to the village gate!
if enemy. type is "ogre":
    self.moveXY(40, 47)