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ā¦