Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[Adventurer] Time To Live

The level Time to Live is available for testing.

This level takes place in the Game Dev 1 campaign, and introduces using an argument with addSurviveGoal.

3 Likes

Hello,

I’m trying to complete the level, but the generator is only spawning skeletons.
Can you take a look at my code?

Thanks!

# 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 = game.spawnXY("generator", 36, 30)
# Set the generator's spawnType to "munchkin"
generator.spawntype = "munchkin"
# Use spawnHeroXY to spawn a hero for the player.
# Remember to assign the spawned hero to a variable!
knight = game.spawnHeroXY("knight", 10, 40)
# Set the hero's maxHealth to 100
knight.maxHealth = 100
# Set the hero's attackDamage to 10
knight.attackDamage = 4.32

# Play the game!

Try this:

generator.spawnType='munchkin'
1 Like

It’s working now.

Thank you!

I’ve got this exact code typed in (*even copies and pasted) and I continue to get the “Incomplete” message of “Set Up Players Hero”.

HELP…

I’ve got the same problem. Anyone got a solution to this?

The code posted above is incomplete. Read the comments and it tells you what to do. If the hero set up is incomplete, then complete it according to the comments.

The problem many people run into on this level is that you need to type the property names exactly as they are in the comments, including capitalization.

maxhealth is not the same as maxHealth, for example.

1 Like

I’ve got the “Set Up Players Hero” problem as well. Has anyone had any luck with solving this problem?

thanks a lot :grinning::grinning:

This means the player must survive for 20 seconds.

game.addSurviveGoal(20)
game.spawnXY(“potion-small”, 50, 20)

Spawn a generator with spawnXY

Use the variable to configure the generator below.

“Gen”.spawnType=‘Munchkin’
game.spawnXY(“generator”, 69, 54)

Use spawnPlayerXY to spawn a hero for the player.

player = game.spawnPlayerXY(“knight”, 15, 15)

Set the player’s maxHealth to at least 100

playermaxHealth=“100”

Set the player’s attackDamage to at least 10

playerdamege=“10”

Play the game!

Whats wrong with this code

Hi @Eli_Andrews, welcome to the CodeCombat Discourse.
Please could you learn to format your code, it really helps us help you with your code, especially when there’s indentation. (I know there isn’t any now, but you might as well learn) This topic can teach you:


Thanks
-Danny

In addition to what @Deadpool198 said, it looks like you have a typo with playerDamage

Two, actually…

1 Like