Level Name: Game Dev 2 Final Project
In-game username: A.Lee452
Description of the bug: The throwers won’t attack the player, and I tried just a thrower and hero, but it still won’t work.
# Create your own game!
# Spawn a player with spawnPlayerXY()
player = game.spawnPlayerXY("samurai", 10, 59)
player.maxSpeed=20
player.maxHealth=200
player.attackDamage=10
# Add at least one goal!
game.addDefeatGoal()
game.addSurviveGoal()
game.addCollectGoal()
#Add move goals at the entrance of each section
game.addMoveGoalXY(8, 51)
game.addMoveGoalXY(8, 34)
game.addMoveGoalXY(8, 18)
#Row One
passageForest1 = game.spawnXY("forest", 8, 51)
game.spawnXY("forest", 17, 51)
game.spawnXY("forest", 26, 51)
game.spawnXY("forest", 35, 51)
game.spawnXY("forest", 43, 51)
game.spawnXY("forest", 52, 51)
game.spawnXY("forest", 61, 51)
game.spawnXY("forest", 72, 51)
game.spawnXY("forest", 69, 51)
#Row 2
passageForest2=game.spawnXY("forest", 8, 34)
game.spawnXY("forest", 17, 34)
game.spawnXY("forest", 26, 34)
game.spawnXY("forest", 35, 34)
game.spawnXY("forest", 43, 34)
game.spawnXY("forest", 52, 34)
game.spawnXY("forest", 61, 34)
game.spawnXY("forest", 72, 34)
game.spawnXY("forest", 69, 34)
#Row 3
game.spawnXY("forest", 8, 18)
game.spawnXY("forest", 17, 18)
game.spawnXY("forest", 26, 18)
game.spawnXY("forest", 35, 18)
game.spawnXY("forest", 43, 18)
game.spawnXY("forest", 52, 18)
game.spawnXY("forest", 61, 18)
game.spawnXY("forest", 72, 18)
game.spawnXY("forest", 69, 18)
#Generators
munchkinSpawner = game.spawnXY("generator", 72, 60)
munchkinSpawner.spawnType = "munchkin"
munchkinSpawner.spawnDelay = 3
#Archers for Challenge 2
game.spawnXY("thrower", 32, 44)
game.spawnXY("thrower", 32, 41)
game.spawnXY("thrower", 25, 41)
game.spawnXY("thrower", 25, 44)
#Challenge 1
game.defeated = 0
ui.track(game, "defeated")
def onDefeat(event):
defeated = event.target
game.defeated += 1
# If 3 ogres are defeated:
if game.defeated == 6:
# Defeat the munchkinSpawner.
munchkinSpawner.defeat()
# Destroy the first forest passage.
passageForest1.destroy()
pass
game.setActionFor("munchkin", "defeat", onDefeat)
game.spawnXY("bronze-coin", 71, 62)
#Challenge 2
game.spawnXY("potion-small", 8, 51)
ui.track(player, "health")
ui.track(player, "collected")
mushroom=game.spawnXY("mushroom",53, 46)
game.spawnXY("silver-coin", 71, 43)
def onCollect(event):
collector = event.target
item = event.other
if item.type=="mushroom":
collector.health =collector.health-200
if item.type == "silver-coin"+ game.defeated >=10:
passageForest2.destroy()
pass
player.on("collect", onCollect)
Screenshot of Error: