Hi !
I’d need help, I’m on the final project dev 2, using Python
here is my code:
game.spawnMaze(“forest”, 1)
Create your own game!
hero = game.spawnPlayerXY(“champion”, 38, 10)
hero.maxHealth = 450
hero.maxSpeed = 13
hero.attackDamage = 30
game.addSurviveGoal()
game.addCollectGoal()
game.addDefeatGoal(10)
Spawn objects into the game with spawnXY()
generator = game.spawnXY(“generator”, 60, 60)
generator.spawnType = “munchkin”
generator.spawnDelay = 4
game.spawnXY(“ogre”, 14, 16)
game.spawnXY(“ogre”, 27, 56)
game.spawnXY(“potion-medium”, 57, 44)
game.spawnXY(“potion-medium”, 37, 13)
def onSpawn(event):
unit = event.target
while true:
unit.findTheNearestEnemy()
if enemy:
unit.attack(enemy)
game.setActionFor(“munchkin”, “spawn”, onSpawn)
game.setActionFor(“ogre”, “spawn”, onSpawn)
bossGoal = game.addManualGoal(“Defeat the boss”)
munchkinsDefeated = 0
ogreDefeated = 0
ui.track(game, defeated)
def onDefeat(event):
unit = event.target
if unit.type == “munchkin”:
munchkinsDefeated = +1
if unit.type == “ogre”:
game.setGoalState(bossGoal, True)
game.setActionFor(“ogre”, “spawn”, onDefeat)
game.setActionFor(“munchkin”, “spawn”, ondefeat)
Except the maze and the hero, nothing appear on the game !
My code may be wrong, or is it a bug ?
Thanks!