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
.
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
.
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'
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.
I’ve got the “Set Up Players Hero” problem as well. Has anyone had any luck with solving this problem?
thanks a lot
game.addSurviveGoal(20)
game.spawnXY(“potion-small”, 50, 20)
“Gen”.spawnType=‘Munchkin’
game.spawnXY(“generator”, 69, 54)
player = game.spawnPlayerXY(“knight”, 15, 15)
playermaxHealth=“100”
playerdamege=“10”
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…