# \[SOLVED\] Freeze Tag (python) Help

**URL:** <https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952>\
**Category:** Level Help\
**Created:** [February 16, 2023, 10:55pm UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952 "2023-02-16T22:55:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![A.Lee452](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/a.lee452/32/43613_2.png) [@A.Lee452](https://discourse.codecombat.com/u/A.Lee452)\
**Post date:** [February 16, 2023, 10:55pm UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/1 "2023-02-16T22:55:12Z")

</div>

Hello. I followed all the instructions and looked at tutorials, but when my player touches an archer, it won’t freeze. I don’t know what to do please help!

```python
# Let's make a game of Freeze Tag!

# game.tagged is used to count tagged archers.
game.tagged = 0
ui.track(game, "tagged")
goal = game.addManualGoal("Tag all archers.")

# Spawn the archers.
game.spawnXY("archer", 12, 52)
game.spawnXY("archer", 12, 16)
game.spawnXY("archer", 24, 52)
game.spawnXY("archer", 24, 16)

player = game.spawnPlayerXY('captain', 68, 24)
player.maxSpeed = 20
# Make the player bigger so it's easier to tag archers.
player.scale = 2

# Set up the archers' speed and behavior properties onSpawn
def onSpawn(event):
    unit = event.target
    unit.behavior = "Scampers"
    unit.maxSpeed = 8

game.setActionFor("archer", "spawn", onSpawn)

# The event handler for "collide" events.
def onCollide(event):
    # The event owner who has collided with something.
    unit = event.target
    # The object the unit collided with.
    other = event.other
    # Use behavior as a marker for the current frozen state.
    # "Scampers" means the archer wasn't yet tagged.
    if unit.behavior == "Scampers":
        # If "other" is the player.
        if "other" is player:
            # Set unit.behavior to "Defends":
            unit.behavior="Defends"
            # Increase game.tagged by 1:
            game.tagged +=1
        pass
    if unit.behavior == "Defends":
        # If other's type is "archer":
        if other.type == "archer":
            # Set unit.behavior to "Scampers":
            unit.behavior = "Scampers"
            # Reduce game.tagged by 1.
            game.tagged -= 1

# Use setActionFor to assign onCollide to the "collide" event for "archer"s.
game.setActionFor("archer", "collide", onCollide)

while True:
    if game.tagged >= 4:
        game.setGoalState(goal, True)

```

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 16, 2023, 11:02pm UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/2 "2023-02-16T23:02:34Z")

</div>

can you give me the link

---

<div class="post-metadata">

**Author:** ![A.Lee452](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/a.lee452/32/43613_2.png) [@A.Lee452](https://discourse.codecombat.com/u/A.Lee452)\
**Post date:** [February 17, 2023, 12:41am UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/3 "2023-02-17T00:41:00Z")

</div>

> **[CodeCombat - Coding games to learn Python and JavaScript](https://codecombat.com/play/level/freeze-tag?&course=57b621e7ad86a6efb5737e64&course-instance=63ea6f607183520024ea8ac5)**
>
> Learn typed code through a programming game. Learn Python, JavaScript, and HTML as you solve puzzles and learn to make your own coding games and websites.

---

<div class="post-metadata">

**Author:** ![A.Lee452](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/a.lee452/32/43613_2.png) [@A.Lee452](https://discourse.codecombat.com/u/A.Lee452)\
**Post date:** [February 17, 2023, 12:43am UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/4 "2023-02-17T00:43:44Z")

</div>

Oh that link that doesn’t work. How do I share the link with you?

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [February 17, 2023, 2:17am UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/5 "2023-02-17T02:17:14Z")

</div>

its fine i can edit the link and it will work

---

<div class="post-metadata">

**Author:** ![MarmiteOnToast](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/marmiteontoast/32/46649_2.png) [@MarmiteOnToast](https://discourse.codecombat.com/u/MarmiteOnToast)\
**Post date:** [February 17, 2023, 7:12am UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/6 "2023-02-17T07:12:45Z")

</div>

Welcome to the Discourse, @A.Lee452 !

> [@A.Lee452](#):
>
> `if "other" is player:`

Here’s your problem.  
`other` is in inverted commas (`""`), which makes the game think it’s a string, not a variable.  
Since `other` is a variable, the level should work if you remove the inverted commas surrounding `other`.  
If you want a more in-depth explanation, feel free to ask.

-Marmite

---

<div class="post-metadata">

**Author:** ![A.Lee452](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/a.lee452/32/43613_2.png) [@A.Lee452](https://discourse.codecombat.com/u/A.Lee452)\
**Post date:** [February 17, 2023, 3:27pm UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/7 "2023-02-17T15:27:43Z")

</div>

Omg that worked that you so much!!

---

<div class="post-metadata">

**Author:** ![ZAX155](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/zax155/32/34141_2.png) [@ZAX155](https://discourse.codecombat.com/u/ZAX155)\
**Post date:** [February 17, 2023, 4:06pm UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/8 "2023-02-17T16:06:28Z")

</div>

If this is solved can you please mark which post helped you the most as the Solution so this topic is closed. Unless there is another problem you have on the same level.  
thanks  
-Zax

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [February 18, 2023, 4:07am UTC](https://discourse.codecombat.com/t/solved-freeze-tag-python-help/34952/9 "2023-02-18T04:07:01Z")

</div>

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