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

Hot Gate #172

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

# Use voice commands to command the artillery.

while True:
    enemy = pet.findNearestEnemy()
    if not enemy:
        continue
    # Scouts are fast. We need stop them. 
    if enemy.type == "scout":
        distance = pet.distanceTo(enemy)
        if pet.isReady("cold-blast") and  distance <10:
            pet.coldBlast()
    else:
        # If the enemy on the left of the pet:
        if enemy.pos.x< pet.pos.x:
            # Say  "left".
            hero.say("left")
        # If the enemy on the right of the pet:
        if enemy.pos.x>pet.pos.x:
            # Say  "right".
            hero.say("right")
        pass