Is this valid
Hey guys! I want to know if code is valid or not it’s not working for me but it could be a possible solution to. My boss battle issues:
if mode == "BossB1" and lives <= 0 then
mode == "gameover"
end
Hey guys! I want to know if code is valid or not it’s not working for me but it could be a possible solution to. My boss battle issues:
if mode == "BossB1" and lives <= 0 then
mode == "gameover"
end
I would need more context to know for sure.
Did you want to have "Boss" to be spelled with three sss? or two ss?
Otherwise, it looks like if you're in BossB1 mode, and you have no (or negative) lives, then the mode switches to "gameover" mode.
no it wasn't supposed to have 3 sss this was a typo but still.
Ok, (assuming there isn't any errors) the only thing I see that could be wrong is the mode. Make sure your game actually sets it to "BossB1" and not "bossB1" or "Bossb1" or anything like that. Also you might not be checkinhg for "gameover" exactly. To check this I would do some debugging by going to the debugging part of the code (its the little purple bug) and check if its getting set to the right thing. While your there make sure lives actually is <= 0
just in case. Also your using an equality a operator (==
)not an assignment operator (=
) (I'm assuming that's a typo.) Hopefully this helps!
What your full code should look like:
if mode == correctvar and lives <= 0 then mode = "gameover" end
Yeah for some reason the mode doesn't actually change so thank you for pointing that out cause I didn't actually know that. When the lives are = 0 the mode doesn't change from "BossB1" to "gameover" so thanks for pointing it out but that still doesn't really fix my issue here. If you want to know how it all started, then it was when I realised that I didn't put "" for my mode change which started this mess. Should I put them back?
If it worked but didnt look nice or you didnt understand it but it DOES work, and the other solutions DONT work then just put it back thats how proggraming works. :D
Huh well that surprisingly worked. Thanks for everyone’s help! :)