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!”)
while True:
pet.moveXY(48, 8)
pet.moveXY(12, 8)
onSpawn = pet.on(“spawn”, onSpawn)
while True:
hero.say(“Run!!!”)
hero.say(“Faster!”)
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: </>
# 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
Is it supposed to no work?
I would help you but
oh ok no problem. I am in a subscriber level, but thanks for trying to help me.
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
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
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
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.