Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

How is this code not working? (code needs to be according to the faq. that is still to be done)

#1

Hi all,
I started code combat earlier and i am on level 17 of game development, i tried to make my own game and it doesn’t work. The character does not follow my mouse clicks and the generators do not spawn things. Pls help!

player = game.spawnPlayerXY(“knight”, 40, 10)
player.maxHealth = “200”
player.attackDamage = “50”
player.maxSpeed = “20”
generator1 = game.spawnXY(“generator”, 60, 60)
generator1.spawnDelay = 20
generator1.spawnType = “munchkin”
generator1.spawnAI = “Defend”
generator1.maxHealth = 100
generator2 = game.spawnXY(“generator”, 60, 27)
generator2.spawnDelay = 20
generator2.spawnType = “thrower”
generator2.spawnAI = “AttacksNearest”
generator2.maxHealth = 100
generator3 = game.spawnXY(“generator”, 60, 10)
generator3.spawnDelay = 20
generator3.spawnType = “munchkin”
generator3.spawnAI = “AttacksNearest”
generator3.maxHealth = 100
generator4 = game.spawnXY(“generator”, 60, 43)
generator4.spawnDelay = 20
generator4.spawnType = “thrower”
generator4.spawnAI = “AttacksNearest”
generator4.maxHealth = 100
generator5 = game.spawnXY(“generator”, 28, 28)
generator5.spawnDelay = 20
generator5.spawnType = “soldier”
generator5.spawnAI = “AttacksNearest”
generator5.maxHealth = 100
generator6 = game.spawnXY(“generator”, 28, 43)
generator6.spawnDelay = 20
generator6.spawnType = “soldier”
generator6.spawnAI = “AttacksNearest”
generator6.maxHealth = 100
generator7 = game.spawnXY(“generator”, 20, 28)
generator7.spawnDelay = 20
generator7.spawnType = “archer”
generator7.spawnAI = “AttacksNearest”
generator7.maxHealth = 100
generator8 = game.spawnXY(“generator”, 20, 43)
generator8.spawnDelay = 20
generator8.spawnType = “arher”
generator8.spawnAI = “AttacksNearest”
generator8.maxHealth = 100
game.spawnXY(“chest”, 60, 35)
game.spawnMaze(“forest”, 11)
game.addSurviveGoal(2)
game.spawnXY(“munchkin”, 12, 50)

#2

Don’t put it in bugs section I think chaboi made a level help section or something

1 Like
#3

Done. Thanks @SuperSmacker. @THATGUYOVERTHERE, please be sure to put the topic in the correct category so we can avoid mess and confusion.

@THATGUYOVERTHERE, Please learn to post your code correctly. The way it is now, we can’t see the structure. Help us help you. It’s very easy to do and just takes a tiny bit of effort. Please read this topic and format your code again correctly