When I try and attack a ogre It just does stuff that I previously did and it freezes a lot
Can you tell in what level it is and a screenshot of your problem?
Did you write all code?
I wrote all the code
here it is
game.spawnMaze(5)
game.spawnXY(“scout”, 60, 58)
game.spawnXY(“scout”, 28, 29)
game.spawnXY(“scout”, 61, 24)
ogref = game.spawnXY(“ogre-f”, 60, 12)
Spawn and configure the hero.
hero = game.spawnPlayerXY(“captain”, 12, 56)
hero.maxHealth = 700000
hero.maxSpeed = 1000000
hero.attackDamage = 25
Spawn a munchkin generator.
generator = game.spawnXY(“generator”, 41, 13)
generator.spawnDelay = 5
generator.spawnType = “munchkin”
Survive goal.
game.addSurviveGoal()
game.spawnXY(“potion-medium”, 28, 12)
addManualGoal adds an incomplete goal with a description
The description will be shown to players.
NOTE that we save it in a variable called scoutGoal
scoutGoal = game.addManualGoal(“Defeat all scouts”)
Use addManualGoal to add a goal to defeat the boss
Save it in a variable called bossGoal
game.addManualGoal(“bossGoal”)game.setActionFor(“scout”, “spawn”, onSpawn)
game.setActionFor(“ogre”, “spawn”, onSpawn)
Count how many scouts are defeated.
scoutsDefeated = 0
Update our manual goals whenever an enemy is defeated.
This is an example of an algorithm using if-statements.
def onDefeat(event):
unit = event.target
if unit.type == “scout”:
scoutsDefeated += 1
hero.say(“Scout down!”)
if scoutsDefeated >= 3:
# Use setGoalState to mark scoutGoal complete.
game.setGoalState(scoutGoal, complete)
hero.say(“All Scouts down!”)
if unit.type == “ogre”:
# Use game.setGoalState to mark bossGoal complete.
# Don’t forget about the second parameter.
game.setGoalState(bossGoal, complete)
hero.say(“Defeated the big boss!”)
Assign the onDefeat handler to the ogres" “defeat”
NOTE that munchkins don’t count toward success!
game.setActionFor(“scout”, “defeat”, onDefeat)
game.setActionFor(“ogre”, “defeat”, onDefeat)
So to kill ogres by clicking on them. To move - click on that place where you want to go. Also, please format your code correctly as it says in this topic:
It will be easier for everyone to see your code.
Please format it correctly so we can see what is going on.
Lydia
And please send a link.
Lydia
this is the link too were the glitches are (for me)
Did you try what I said?
There is not a glitch, it worked perfectly fine for me.
Your code is not good however, and that may be the reason why. So PLEASE format your code CORRECTLY!
Lydia
I did what you asked me to do @PeterPalov but it just freezes when try and click on it
Like I said, it is your code, format it correctly so we can help you. It only takes 30 seconds.
Lydia
Can you send a link to the level where you have problem?
Thanks. So can you format your code correctly?
this is the code formatted i had to guess some because i can’t just read your mind
game.spawnMaze(5)
game.spawnXY(“scout”, 60, 58)
game.spawnXY(“scout”, 28, 29)
game.spawnXY(“scout”, 61, 24)
ogref = game.spawnXY(“ogre-f”, 60, 12)
#Spawn and configure the hero.
hero = game.spawnPlayerXY(“captain”, 12, 56)
hero.maxHealth = 700000
hero.maxSpeed = 1000000
hero.attackDamage = 25
#Spawn a munchkin generator.
generator = game.spawnXY(“generator”, 41, 13)
generator.spawnDelay = 5
generator.spawnType = “munchkin”
#Survive goal.
game.addSurviveGoal()
game.spawnXY(“potion-medium”, 28, 12)
#addManualGoal adds an incomplete goal with a description
#The description will be shown to players.
#NOTE that we save it in a variable called scoutGoal
scoutGoal = game.addManualGoal(“Defeat all scouts”)
#Use addManualGoal to add a goal to defeat the boss
#Save it in a variable called bossGoal
game.addManualGoal(“bossGoal”)game.setActionFor(“scout”, “spawn”, onSpawn)
game.setActionFor(“ogre”, “spawn”, onSpawn)
#Count how many scouts are defeated.
scoutsDefeated = 0
#Update our manual goals whenever an enemy is defeated.
#This is an example of an algorithm using if-statements.
def onDefeat(event):
unit = event.target
if unit.type == “scout”:
scoutsDefeated += 1
hero.say(“Scout down!”)
if scoutsDefeated >= 3:
# Use setGoalState to mark scoutGoal complete.
game.setGoalState(scoutGoal, complete)
hero.say(“All Scouts down!”)
if unit.type == “ogre”:
# Use game.setGoalState to mark bossGoal complete.
# Don’t forget about the second parameter.
game.setGoalState(bossGoal, complete)
hero.say(“Defeated the big boss!”)
#Assign the onDefeat handler to the ogres" “defeat”
#NOTE that munchkins don’t count toward success!
game.setActionFor(“scout”, “defeat”, onDefeat)
game.setActionFor(“ogre”, “defeat”, onDefeat)
and also i can’t help you as i have restarted