I’m on level 36.
[Message must be at least 20 characters.]
I’m on level 36.
[Message must be at least 20 characters.]
ive beaten all levels in dungeon now im working on forest beaten all non subscrber hold on ill send a screenshot and im level 30
How do you send screenshots?
you know how to take screen shots on you cpu?
Not really…
[Message must be at least 20 characters.]
what kind of cpu r u on?
while True:
enemy = hero.findNearestEnemy()
if enemy.type == "muchkin" or enemy.type == "thrower":
hero.attack(enemy)
item = hero.findNearestItem()
if item.type == "gem" or item.type == "coin":
hero.moveXY(item.pos.x, item.pos.y)
pass
do you know what is wrong with this code?
It’s just a small typo; it’s spelled “munchkin”.
and for you to take a screenshot you must press Alt + PrtScn then when your replying there is a button that has a box with arrow pointing up use that and it should work and thanks
Thanks, and you’re welcome!
.
try it and see if it works for you
I tried to take a screenshot but it wouldn’t work, and when I tried to upload an image from the web it gave a link to CodeCombat instead.
i dont know i just looked it up online
# How do you find the nearest friendly unit?
# horse = ?
horse = hero.findFriends()
if horse:
x1 = horse.pos.x - 7
x2 = horse.pos.x + 7
if x1 >= 1:
# Move to the horse's y position but use x1 for the x position.
hero.moveXY(x1, hore.pos.y)
elif x2 <= 79:
# Move to the horse's y position but use x2 for the x position.
hero.moveXY(x2, horse.pos.y)
distance = hero.distanceTo(horse)
if distance <= 10:
hero.say("Whoa")
# Move to the red x to return the horse to the farm.
hero.moveXY(27, 54)
# Move back out into the pasture to begin looking for the next horse.
hero.moveXY(53, 29)
```
can you help me with this i cant do this one
First of all:
horse = hero.findNearest(hero.findFriends())
The findFriends() method returns an array of ALL friends, not just the one nearest you. That’s why you need the findNearest(so and so) method.
Also:
hero.moveXY(x1, hore.pos.y)
Typos are always an important thing to look out for.
Other than that, I think your code looks good.
i got it done like 5 minutes ago lol but, thanks anyway right
You’re welcome!
[Message must be at least 20 characters.]