# Gam Dev 2 Final Project

**URL:** https://discourse.codecombat.com/t/gam-dev-2-final-project/32989
**Category:** Level Help
**Created:** [May 13, 2022, 1:24pm UTC](https://discourse.codecombat.com/t/gam-dev-2-final-project/32989 "2022-05-13T13:24:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tanqelo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/tanqelo/32/29064_2.png) [@Tanqelo](https://discourse.codecombat.com/u/Tanqelo)
#### Post date: [May 13, 2022, 1:24pm UTC](https://discourse.codecombat.com/t/gam-dev-2-final-project/32989/1 "2022-05-13T13:24:56Z")

</div>

I did all the steps for the final project but it is still asking me to “include the hero” is there something I am missing? Here is my code

```python
# Create your own game!

# Spawn a player with spawnPlayerXY()
hero = game.spawnXY("knight", 19, 30)
# Add at least one goal!
money = game.addManualGoal("Increase your money!!!")
# Spawn objects into the game with spawnXY()
game.spawnXY("chest", 52, 50)
game.spawnXY("chest", 57, 50)
for i in range(5):
    game.spawnXY("fence", 8*i + 40, 30)
    game.spawnXY("forest", 36, 8*i + 40)
for i in range(10):
    game.spawnXY("captain", 28, 5*i + 10)
    game.spawnXY("thrower", 68, 5*i + 10)

def onSpawn(event):
    while True:
        unit = event.target
        enemy = unit.findNearestEnemy()
        if enemy:
            unit.attack(enemy)

game.setActionFor("captain", "spawn", onSpawn)
game.setActionFor("thrower", "spawn", onSpawn)
game.score = 0

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

hero.on("collect", onCollect)
def checkGoal():
    if game.score > 100:
        game.setGoalState(money, True)
        
# Playomg tje game
while True:
    checkGoal()
    enemy = hero.findNearestEnemy()
    coin = hero.findNearestItem()
    if enemy:
        hero.attack(enemy)
    elif coin:
        hero.attack(coin)
    

```

There are no errors just I have all of the objectives excpet for include the hero.

---

<div class="post-metadata">

### Author: ![moonwatcher348](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/moonwatcher348/32/24126_2.png) [@moonwatcher348](https://discourse.codecombat.com/u/moonwatcher348)
#### Post date: [May 13, 2022, 2:01pm UTC](https://discourse.codecombat.com/t/gam-dev-2-final-project/32989/2 "2022-05-13T14:01:51Z")

</div>

Use `spawnPlayerXY` not `spawnXY` for the hero

---

<div class="post-metadata">

### Author: ![fuery](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/fuery/32/33856_2.png) [@fuery](https://discourse.codecombat.com/u/fuery)
#### Post date: [April 18, 2023, 6:26pm UTC](https://discourse.codecombat.com/t/gam-dev-2-final-project/32989/3 "2023-04-18T18:26:35Z")

</div>

> [@Tanqelo](#):
>
> `hero = game.spawnXY("knight", 19, 30)`

use game.spawnPlayerXY() instead of game.spawnXY().
