Forest cannon dancing help [SOLVED]

while True:
pet.moveXY(48, 8)
pet.moveXY(12, 8)
onSpawn = pet.on(“spawn”, onSpawn)

Cheer up your pet. Don’t remove this:

while True:
hero.say(“Run!!!”)
hero.say(“Faster!”)

Screen Shot 2021-04-12 at 12.58.21 PM

It says that I didn’t cheer and my hero isn’t cheering on the pet

Instead of taking a picture of your code, you can use this button: </>

1 Like
# Your pet should run back and forth on the X marks.
# The hero should cheer the whole time!

# Write the event function onSpawn for the pet.
# This function should make the wolf run back and forth:
# First, run to the right mark, then the left one:
while True:
    pet.moveXY(48, 8)
    pet.moveXY(12, 8)
    pass
onSpawn = pet.on("spawn", onSpawn)

while True:
    hero.say("Run!!!")
    hero.say("Faster!")
    pass
1 Like

Is it supposed to no work?

I would help you but

  1. I’m a horrible coder
  2. I can’t use pets
  3. I’m pretty sure your in a level ahead of me or a subscriber level

oh ok no problem. I am in a subscriber level, but thanks for trying to help me.

2 Likes

Replace this while true statement with a defining statement. You want to define onSpawn(), not have a while true statement. The second while true statement will never run if there is a while true statement before it.

def onSpawn():
    while hero.time < 43:
        pet.moveXY(48, 8)
        pet.moveXY(12, 8)

it says that it ran out of time

The abc help is OK and every number between 27 and infinity will also work.
while True: is the usual way to command the pet to make repeatable actions:

def onSpawn():
    # while hero.time < float("inf"):
    # while hero.time < 27:
    while True:
        pet.moveXY(48, 8)
        pet.moveXY(12, 8)
pet.on("spawn", onSpawn)
# default code follows , Don't remove it
1 Like
def onSpawn():
    while hero.time < 43:
        pet.moveXY(48, 8)
        pet.moveXY(12, 8)
    pass
onSpawn = pet.on("spawn", onSpawn)

while True:
    hero.say("Run!!!")
    hero.say("Faster!")
    pass

I did it and it made my pet go to my character

Your current code works perfectly fine for me.

for me it goes to mmy character

Thanks I just figured it out. I accidentally removed my cheer up part. LOL. Thanks @abc @xython @enPointe77 THANKS GUYS

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.