# Need help- Game Development Level 2

**URL:** <https://discourse.codecombat.com/t/need-help-game-development-level-2/13070>\
**Category:** Level Help\
**Created:** [November 29, 2017, 6:30pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070 "2017-11-29T18:30:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianamy10](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@brianamy10](https://discourse.codecombat.com/u/brianamy10)\
**Post date:** [November 29, 2017, 6:30pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/1 "2017-11-29T18:30:46Z")

</div>

We are new to Code Combat and trying to understand coding. I (mom) need help to show my son (age 14) how to get past this level he is on. He has some beginning knowledge of code and I have little to none so it is tough getting through this. I hate that we bought this and even after contacting Code Combat and getting some hints in a reply from the CEO, we still can’t get past this. Honestly, it all give me a headache, but I am determined to press through and not get too frustrated!

He is on Game Development- part 16 called Time to Live. The code he tried and then edited with hints from the CEO are… (what is the best way to copy and paste the code here for people to see it?- I think it would help if the line numbers were there, but I don’t know how to copy and paste that)

# Pass an argument to addSurviveGoal() to specify a time.

# This means the player must survive for 20 seconds.

game.addSurviveGoal(20)

# Spawn a generator with spawnXY

# Remember to assign the spawned generator to a variable!

# Use the variable to configure the generator below.

# generator.spawnType=“munchkin”

# Set the generator’s spawnType to “munchkin”

mySpawn = game.spawnXY(“generator”, 36, 30)  
generatospawnType=“munchkin”

# Use spawnHeroXY to spawn a hero for the player.

# Remember to assign the spawned hero to a variable!

hero = game.spawnHeroXY(55, 16)

# Set the hero’s maxHealth to 100

hero.maxHealth=100

# Set the to 10

hero.attackDamage=10

# Play the game!

---

<div class="post-metadata">

**Author:** ![John\_F\_Morrison\_Jr](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/john_f_morrison_jr/32/7149_2.png) [@John\_F\_Morrison\_Jr](https://discourse.codecombat.com/u/John_F_Morrison_Jr)\
**Post date:** [November 29, 2017, 6:41pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/2 "2017-11-29T18:41:25Z")

</div>

I can’t help with code but to paste code here do the following.

Go to FAQ and look for where it talks about triple brackets

---

<div class="post-metadata">

**Author:** ![brianamy10](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@brianamy10](https://discourse.codecombat.com/u/brianamy10)\
**Post date:** [November 29, 2017, 6:44pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/3 "2017-11-29T18:44:57Z")

</div>

Thank you! I will try it…

---

<div class="post-metadata">

**Author:** ![brianamy10](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@brianamy10](https://discourse.codecombat.com/u/brianamy10)\
**Post date:** [November 29, 2017, 6:48pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/4 "2017-11-29T18:48:49Z")

</div>

```python

# This means the player must survive for 20 seconds.
game.addSurviveGoal(20)

# Spawn a generator with spawnXY
# Remember to assign the spawned generator to a variable!
# Use the variable to configure the generator below.
# generator.spawnType="munchkin"
# Set the generator's spawnType to "munchkin"
mySpawn = game.spawnXY("generator", 36, 30)
generatospawnType="munchkin"
# Use spawnHeroXY to spawn a hero for the player.
# Remember to assign the spawned hero to a variable!
hero = game.spawnHeroXY(55, 16)
# Set the hero's maxHealth to 100
hero.maxHealth=100 
# Set the to 10
hero.attackDamage=10

# Play the game!

```

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [November 29, 2017, 7:31pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/5 "2017-11-29T19:31:23Z")

</div>

I haven’t done game dev yet but this appears to be a problem.

 ![001Temp](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/8/8d7d861a9b2c75ccc96bd4de26c6c05c749d5df2.JPG)

---

<div class="post-metadata">

**Author:** ![Keir\_G](https://avatars.discourse-cdn.com/v4/letter/k/e56c9b/32.png) [@Keir\_G](https://discourse.codecombat.com/u/Keir_G)\
**Post date:** [December 9, 2017, 7:08am UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/6 "2017-12-09T07:08:42Z")

</div>

There is more to it…

mySpawn = game.spawnXY(“generator”, 36, 30)

Think of that line of code in reverse, so you will be naming the spawned generator  
what it (equals)

so you have to set  
generatospawnType="munchkin"  
to  
mySpawn.spawnType=“munchkin”

if you play back through a few of the levels in front and really read the code you should understand why,  
ie. level 15. behavior driven development…

skeleton1 = game.spawnXY(“skeleton”, 60, 50)  
skeleton2 = game.spawnXY(“skeleton”, 60, 30)  
skeleton3 = game.spawnXY(“skeleton”, 60, 10)

skeleton1.behavior = "Scampers"  
skeleton2.behavior = “Scampers”  
– Assign “Scampers” to skeleton3.behavior  
skeleton3.behavior = “Scampers”

– used for the comment

---

<div class="post-metadata">

**Author:** ![Shamar](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Shamar](https://discourse.codecombat.com/u/Shamar)\
**Post date:** [January 22, 2019, 1:50pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/7 "2019-01-22T13:50:51Z")

</div>

// Pass an argument to addSurviveGoal() to specify a time.

// This means the player must survive for 20 seconds.  
game.addSurviveGoal(20);

// Spawn a generator with spawnXY  
// Use the variable to configure the generator below.  
var generator = game.spawnXY(“generator”, 60, 40);

// Set the generator’s spawnType to “munchkin”  
var vargeneratorspawnType = “munchkin”;

// Use spawnPlayerXY to spawn a hero for the player.  
var player = game.spawnPlayerXY(“knight”, 15, 15);

// Set the player’s maxHealth to at least 100  
player.maxHealth = 100;

// Set the player’s attackDamage to at least 10  
player.attackDamage = 10;

// Play the game!

Not working! Need help!

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [January 23, 2019, 1:01am UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/8 "2019-01-23T01:01:19Z")

</div>

Please learn to post your code correctly. The way it is now, we can’t see the structure. Help us help you. It’s very easy to do and just takes a tiny bit of effort. Please read this topic and format your code again correctly

> [@\[Essentials\] How To Post/Format Your Code Correctly](https://discourse.codecombat.com/t/essentials-how-to-post-format-your-code-correctly/15521):
>
> Formatting your code before posting code is essential to our community, and if you don’t we might not be able to help frowning Everyone must know how to format ALL of your code properly. It’s really easy and only requires a very small amount of effort. To post your code from the game , use the \</\> button or it won’t format properly. When you click the \</\> button, the following will appear: Please paste ALL …

---

<div class="post-metadata">

**Author:** ![Lonzo\_Terry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lonzo_terry/32/10919_2.png) [@Lonzo\_Terry](https://discourse.codecombat.com/u/Lonzo_Terry)\
**Post date:** [October 30, 2019, 7:35pm UTC](https://discourse.codecombat.com/t/need-help-game-development-level-2/13070/9 "2019-10-30T19:35:36Z")

</div>

You can tap on the knight in spawnables look at the default code then use but put what you want in
