The Game Dev 2 Teatime level has some peculiar behavior. I saw a previous bug about it from years ago, but also saw an admonition not to revive old threads, so here’s a new one. The behavior is exactly the same as described in “old post”: Web Development 2 Level: Teatime HELP
Rather than spawning two mobs at the designated intervals, the game spawns an endless stream of them - and also uses so much processing power that the game stutters. I eventually reset all the code to “start over”. (This did not fix it.) Then I commented out (added “#”) the munchkin 2 spawn event and ran the code (without providing instructions to spawn the throwers). It spawned only one monster, as expected. I then removed the # and commented out munchkin 1, and it correctly created only the one mob from the other direction.
Then, I removed all the # comments and finished the code.
And it ran correctly.
I don’t know why this would occur. (I’m using Chrome, if that matters.)
@Bryukh - I see you announced the level years back, so are you the person to talk to about fixing it? Or is there someone else if you are not the best person for this now?
Thank you for looking into it, or for providing me some context so I can avoid repeating the problem.
# Use timers to spawn enemies and items. # This spawns two aggressive munchkins. def spawnMunchkins(): munchkin1 = game.spawnXY("munchkin", 2, 12) munchkin2 = game.spawnXY("munchkin", 2, 56) munchkin1.behavior = "AttacksNearest" munchkin2.behavior = "AttacksNearest" # This spawns two aggressive throwers. def spawnThrowers(): thrower1 = game.spawnXY("thrower", 2, 16) thrower1.behavior = "AttacksNearest" thrower2 = game.spawnXY("thrower", 2, 52) thrower2.behavior = "AttacksNearest" # This spawns a health potion near the village. def spawnPotion(): game.spawnXY("potion-large", 46, 34) # Survive 30 seconds. game.addSurviveGoal(30) # The inital values of timers define the first appearance. game.munchkinSpawnTime = 0 game.throwerSpawnTime = 0 game.potionSpawnTime = 6 # This is used for UI. game.nextPotionIn = 0 ui.track(game, "time") # Lets show how long until the next potion. ui.track(game, "nextPotionIn") player = game.spawnPlayerXY("duelist", 40, 34) player.maxSpeed = 15 # This checks and updates timers. def updateTimers(): # If game time is greater than the munchkinSpawnTime if game.time > game.munchkinSpawnTime: # Update the timer and spawn the munchkins. game.munchkinSpawnTime = game.munchkinSpawnTime + 6 spawnMunchkins() # If game time is greater than potionSpawnTime if game.time > game.potionSpawnTime: player.say("The potion is here!") # Increase game.potionSpawnTime by 6: game.potionSpawnTime = game.potionSpawnTime + 6 # Call the spawnPotion function: spawnPotion() # If game time is greater than throwerSpawnTime: if game.time > game.throwerSpawnTime: # Increase game.throwerSpawnTime by 9: game.throwerSpawnTime = game.throwerSpawnTime + 9 # Call the spawnThrowers function: spawnThrowers() # Update the UI timer until the next potion game.nextPotionIn = game.potionSpawnTime - game.time while True: updateTimers()