# Game dev 2 help needed!

**URL:** <https://discourse.codecombat.com/t/game-dev-2-help-needed/21322>\
**Category:** Level Help\
**Created:** [May 1, 2020, 1:56am UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322 "2020-05-01T01:56:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![taha1124](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@taha1124](https://discourse.codecombat.com/u/taha1124)\
**Post date:** [May 1, 2020, 1:56am UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/1 "2020-05-01T01:56:41Z")

</div>

I’m on Game Dev 2 Final Project. My level meets all the requirements, but it won’t let me go to the next level.

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 1, 2020, 1:53pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/2 "2020-05-01T13:53:32Z")

</div>

Hi @taha1124, welcome to the CodeCombat discourse.  
I’m afraid after Game Dev 2 Final project there aren’t any more levels. That’s the end unfortunately.  
Or are you saying your code meets the requirements but it’s not saying ‘success’?  
Danny

---

<div class="post-metadata">

**Author:** ![taha1124](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@taha1124](https://discourse.codecombat.com/u/taha1124)\
**Post date:** [May 1, 2020, 4:44pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/3 "2020-05-01T16:44:57Z")

</div>

Yeah, it won’t say success.

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 1, 2020, 4:50pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/4 "2020-05-01T16:50:19Z")

</div>

Ok, please could you post a screenshot of this.  
Have you played and won the level you made yet?  
Danny

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [May 1, 2020, 4:53pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/5 "2020-05-01T16:53:12Z")

</div>

also, please post your code (properly formatted)…since this is a ‘create your own’ level, being able to see what you’ve come up with will help us troubleshoot.

---

<div class="post-metadata">

**Author:** ![taha1124](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@taha1124](https://discourse.codecombat.com/u/taha1124)\
**Post date:** [May 1, 2020, 5:00pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/6 "2020-05-01T17:00:29Z")

</div>

def spawnArcher(x, y):  
archer = game.spawnXY(“archer”, x, y)  
archer.behavior = “Defends”  
archer.attackDamage = 20  
goliath = game.spawnPlayerXY(“goliath”, 20, 35)  
boss = game.spawnXY(“ogre”, 67, 15)  
boss.attackDamage = 200  
boss.maxSpeed = 1  
boss.maxHealth = 200  
goliath.maxSpeed = 10  
boss.behavior = “AttacksNearest”  
bossGoal = game.addManualGoal(“Kill the boss”)  
game.addCollectGoal(1)  
goliath.maxHealth = 20000  
goliath.attackDamage = 20  
game.spawnXY(“fence”, 72, 9)  
game.spawnXY(“fence”, 68, 9)  
game.spawnXY(“fence”, 64, 9)  
game.spawnXY(“fence”, 72, 13)  
game.spawnXY(“fence”, 72, 17)  
game.spawnXY(“fence”, 68, 17)  
game.spawnXY(“fence”, 64, 17)  
game.spawnXY(“fence”, 72, 13)  
fence1 = game.spawnXY(“fence”, 60, 13)  
def onDefeat1(event):  
unit = event.target  
if unit.type == “ogre”:  
bossGoal.success == True  
game.spawnXY(“chest”, 36, 30)

def spawnMunchkin(x, y):  
ogre = game.spawnXY(“munchkin”, x, y)  
ogre.behavior = “AttacksNearest”

def spawnArcherWall():  
spawnArcher(10, 54)  
spawnArcher(10, 44)  
spawnArcher(10, 34)  
spawnArcher(10, 24)  
spawnArcher(10, 14)

def spawnOgreWave():  
offset = game.randomInteger(-6, 6)  
spawnMunchkin(80, 22 + offset)  
spawnMunchkin(80, 28 + offset)  
spawnMunchkin(80, 34 + offset)  
spawnMunchkin(80, 40 + offset)  
spawnMunchkin(80, 46 + offset)  
spawnMunchkin(80, 52 + offset)

def onDefeat2(event):  
unit = event.target  
game.defeated +=1  
unit.destroy()

game.setActionFor(“munchkin”, “defeat”, onDefeat2)  
game.setActionFor(“ogre”, “defeat”, onDefeat1)

game.defeated = 0  
game.spawnTime = 0  
goal = game.addManualGoal(“Defeat over 100 ogres.”)  
ui.track(game, “defeated”)

def checkSpawnTimer():  
if game.time \> game.spawnTime:  
spawnOgreWave()  
game.spawnTime += 5

def checkGoal1():  
if game.defeated \> 100:  
goal.success = True  
fence1.destroy()

spawnArcherWall()  
while True:  
checkSpawnTimer()  
checkGoal1()

---

<div class="post-metadata">

**Author:** ![taha1124](https://avatars.discourse-cdn.com/v4/letter/t/c6cbf5/32.png) [@taha1124](https://discourse.codecombat.com/u/taha1124)\
**Post date:** [May 1, 2020, 5:10pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/7 "2020-05-01T17:10:09Z")

</div>

```python
def spawnArcher(x, y):
    archer = game.spawnXY("archer", x, y)
    archer.behavior = "Defends"
    archer.attackDamage = 20
goliath = game.spawnPlayerXY("goliath", 20, 35)
boss = game.spawnXY("ogre", 67, 15)
boss.attackDamage = 200 
boss.maxSpeed = 1
boss.maxHealth = 200
goliath.maxSpeed = 10
boss.behavior = "AttacksNearest" 
bossGoal = game.addManualGoal("Kill the boss")
game.addCollectGoal(1)
goliath.maxHealth = 20000
goliath.attackDamage = 20
game.spawnXY("fence", 72, 9)
game.spawnXY("fence", 68, 9)
game.spawnXY("fence", 64, 9)
game.spawnXY("fence", 72, 13)
game.spawnXY("fence", 72, 17)
game.spawnXY("fence", 68, 17)
game.spawnXY("fence", 64, 17)
game.spawnXY("fence", 72, 13)
fence1 = game.spawnXY("fence", 60, 13)
def onDefeat1(event):
    unit = event.target
    if unit.type == "ogre":
        bossGoal.success == True
        game.spawnXY("chest", 36, 30)

            
            
            
def spawnMunchkin(x, y):
    ogre = game.spawnXY("munchkin", x, y)
    ogre.behavior = "AttacksNearest"

def spawnArcherWall():
    spawnArcher(10, 54)
    spawnArcher(10, 44)
    spawnArcher(10, 34)
    spawnArcher(10, 24)
    spawnArcher(10, 14)

def spawnOgreWave():
    offset = game.randomInteger(-6, 6)
    spawnMunchkin(80, 22 + offset)
    spawnMunchkin(80, 28 + offset)
    spawnMunchkin(80, 34 + offset)
    spawnMunchkin(80, 40 + offset)
    spawnMunchkin(80, 46 + offset)
    spawnMunchkin(80, 52 + offset)

def onDefeat2(event):
    unit = event.target
    game.defeated +=1
    unit.destroy()
    

game.setActionFor("munchkin", "defeat", onDefeat2)
game.setActionFor("ogre", "defeat", onDefeat1)

game.defeated = 0
game.spawnTime = 0
goal = game.addManualGoal("Defeat over 100 ogres.")
ui.track(game, "defeated")

def checkSpawnTimer():
    if game.time > game.spawnTime:
        spawnOgreWave()
        game.spawnTime += 5

def checkGoal1():
    if game.defeated > 100:
        goal.success = True
        fence1.destroy()

spawnArcherWall()
while True:
    checkSpawnTimer()
    checkGoal1()

```

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [May 1, 2020, 7:32pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/8 "2020-05-01T19:32:35Z")

</div>

Thanks for formatting!

It looks like the problem is with bossGoal. If you comment out the ‘bossGoal=’ line and the ‘bossGoal.success’ line in the definition, the game will complete when you collect the chest.

I haven’t found the exact problem (yet), but I see two options…either combine the two manual goals in to one, by making it something like “Defeat over 100 ogres to release the boss…then kill him too!”, or, figure out why defeating him is not being counted as a goal completion. (Personally, I’m going to keep looking for the cause 😜)

---

<div class="post-metadata">

**Author:** ![dedreous](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/dedreous/32/13849_2.png) [@dedreous](https://discourse.codecombat.com/u/dedreous)\
**Post date:** [May 1, 2020, 8:00pm UTC](https://discourse.codecombat.com/t/game-dev-2-help-needed/21322/9 "2020-05-01T20:00:53Z")

</div>

Found it…line 28, you have ‘==’ where it should be ‘=’. Man, that one was sneaky! 😁
