Ynnos
1
On my code the enemies are not spawning in the level
game.spawnMaze("forest", 97)
player = game.spawnPlayerXY("knight", 36, 28)
player.maxHealth = 1
player.attackDamage = 0
game.addSurviveGoal(50)
game.addManualGoal("Dont get touched by enemies !")
# Spawn objects into the game with spawnXY()
waveCooldown = 5
waveSize = 5
waveTime = 3
ui.track(game, "time")
def spawnEnemies(offset) :
thrower = game.spawnXY("thrower", 12 + offset, 12)
munchkin = game.spawnXY("munchkin", 12 + offset + 5, 12)
scout = game.spawnXY("scout", 12 + offset + 7, 12)
def wave() :
while game.time > waveTime :
offset = game.randomInteger(0, 30)
spawnEnemies()
waveTime = game.time + waveCooldown
archer = game.spawnXY("archer", 41, 30)
archer.maxSpeed = 0
while True :
wave()
Aya
2
You forgot to put in a parameter, you defined it, but forgot to use it
Ynnos
3
I corrected the problem but the enemies are still not spawning
Aya
4
Can you repost your new code please?
Ynnos
5
game.spawnMaze("forest", 97)
player = game.spawnPlayerXY("knight", 36, 28)
player.maxHealth = 1
player.attackDamage = 0
game.addSurviveGoal(50)
game.addManualGoal("Dont get touched by enemies !")
# Spawn objects into the game with spawnXY()
waveCooldown = 5
waveSize = 5
waveTime = 3
ui.track(game, "time")
def spawnEnemies(offset) :
thrower = game.spawnXY("thrower", 12 + offset, 12)
munchkin = game.spawnXY("munchkin", 12 + offset + 5, 12)
scout = game.spawnXY("scout", 12 + offset + 7, 12)
def wave() :
while game.time > waveTime :
offset = game.randomInteger(0, 30)
spawnEnemies(offset)
waveTime = game.time + waveCooldown
archer = game.spawnXY("archer", 41, 30)
archer.maxSpeed = 0
while True :
wave()
1 Like
Aya
6
Try replacing the above with this: waveTime += 5
system
Closed
7
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.