# Guys help me please

**URL:** <https://discourse.codecombat.com/t/guys-help-me-please/37983>\
**Category:** Level Help\
**Created:** [July 16, 2024, 8:37am UTC](https://discourse.codecombat.com/t/guys-help-me-please/37983 "2024-07-16T08:37:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kitten](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kitten/32/41694_2.png) [@kitten](https://discourse.codecombat.com/u/kitten)\
**Post date:** [July 16, 2024, 8:37am UTC](https://discourse.codecombat.com/t/guys-help-me-please/37983/1 "2024-07-16T08:37:11Z")

</div>

**guy,i can’t fix the bug in level 26 game dev island**  
**here it’s,you can try**

> **[CodeCombat - Coding games to learn Python and JavaScript](https://codecombat.com/play/game-dev-level/game-dev-2-final-project/6689e0ccb9bede01bda24058?course=57b621e7ad86a6efb5737e64)**
>
> 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.

**here is my code**

```python
player = game.spawnPlayerXY("captain", 40, 34)
player.health=300
scout=game.spawnXY("scout", 40, 5)
scout.attackDamage=150
player.maxSpeed = 20
game.score=0
itemInterval = 1
itemSpawnTime = 2
requiredScore = 200
goldGoal = game.addManualGoal('nhặt được ít nhất 200 điểm và tiêu diệt quái vật trong 90s')
game.addDefeatGoal(1)
ui.track(game, "score")
ui.track(game,'time')
ui.track(game,'defeat')
def defeat():
    game.defeat+=1

def onSpawn(event):
    unit = event.target
    unit.attackDamage = 300
    while True:
        # Kẻ địch bỏ chạy khỏi người chơi to lớn.
        if game.score>=200:
            unit.maxSpeed=25
            player.attackDamage=1000
            unit.behavior = "RunsAway"
        else:
            unit.behavior = "AttacksNearest"

def spawnRandomItem():
    itemNumber = game.randomInteger(1, 5)
    ssr=game.randomInteger(1, 50)
    x = game.randomInteger(12, 68)
    y = game.randomInteger(12, 56)
    if ssr==9:
        game.spawnXY("chest", x, y)
    if itemNumber <=2:
        game.spawnXY("bronze-coin", x, y)
    else:
        if itemNumber ==3:
            game.spawnXY("gold-coin", x, y)
        else:
            if itemNumber ==4:
                game.spawnXY("gem", x, y)
            else:
                trap=game.spawnXY("fire-trap", x, y)
                game.spawnXY("gold-coin", x, y-2)
                trapdespawntime=game.time+5
                if trapdespawntime==game.time:
                    trap.destroy

def checkSpawnTimer():
    if game.time >= itemSpawnTime:
        spawnRandomItem()
        itemSpawnTime += itemInterval

def onCollect(event):
    item = event.other
    if item.value:
        game.score += item.value

def checkGoals():
    if game.score >= requiredScore:
        game.setGoalState(goldGoal, True)
    else:
        if game.time>=90:
            game.spawnXY("fire-trap", player.pos.x, player.pos.y)

while True:
    if player.health>0:
        checkSpawnTimer()
    checkGoals()
    scout.on('spawn',onSpawn)
    player.on('collect',onCollect)

```

---

<div class="post-metadata">

**Author:** ![Piano\_Zombie](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/piano_zombie/32/22424_2.png) [@Piano\_Zombie](https://discourse.codecombat.com/u/Piano_Zombie)\
**Post date:** [July 17, 2024, 1:07am UTC](https://discourse.codecombat.com/t/guys-help-me-please/37983/2 "2024-07-17T01:07:33Z")

</div>

I’m so confused. What is the bug you’re talking about? The code runs just fine.

---

<div class="post-metadata">

**Author:** ![kitten](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kitten/32/41694_2.png) [@kitten](https://discourse.codecombat.com/u/kitten)\
**Post date:** [July 17, 2024, 9:45am UTC](https://discourse.codecombat.com/t/guys-help-me-please/37983/3 "2024-07-17T09:45:11Z")

</div>

when i picked up a gem or coin it plus for my score up to 200+ instead of their value
