AlexeySapsay / Python_solution_CodeCombat_2018

In that repository I will post my sollution for codecombat.com games for study Python
1 stars 0 forks source link

Olympic Race #194

Open AlexeySapsay opened 6 years ago

AlexeySapsay commented 6 years ago
# Follow me on youtube  channel Phy Tu
# Help with programming on Python, school math, physics
# https://www.youtube.com/channel/UCP5ycahCEZ24qmRRgNnko5Q

# The pet must win the race.
# Runners should touch their teams mark and run back.

def Go(event):
    referee = pet.findNearestByType("wizard")
    # If the referee is speaker and the message is "Start":
    if event.speaker==referee and event.message=="Start":
        # Make the pet run to the red mark.
        pet.moveXY(54,27)
        # Then run back.
        pet.moveXY(6,27)

# Assign the onHear function to handle "hear" events.
pet.on("hear",Go)