Hey Everyone,
I have coded a very simple game which works perfectly except the part where the player loses.
I have a function called, dead with a condition that if deadSign == true show 2 pictures (PNG)
which one of the pictures is ReStart icon to basically reset the sketch and go back to the top of the Draw()
I have upload all the pictures + the sketch in a zip file
So if you download and play it.you will see the problem.
just start the game and then click GO - and then do nothing till timer hits 0
which mean you lose…
then you see the restart icon there…and you can even click on it…
but you see the problem…
i would really appreciate your help since im working on this work 2 weeks and cant figure this part out…
try to move the canvas window and you see many other (level pictures ) flicker,
that means for me that you just draw all levels from start to death over an other
( well yes you do that in draw )
but in that functions you not disable them correctly
like when you check on
if (lvl1 == true) {
check “how long” that { } is, ( by placing the editor cursor behind the {
it should cover/disable the whole function i think.
as for your start button you have to reset all your booleans to false
in your code a lot of things are redundant: example in your menu(): you begin to show images then you add an if()…and show two or three of them, which is absolutely useless…
error line 166 (mouseClicked): if the user in the first level clicks there, it fires the winner level 3 and it s possible that this kind of event happens for other places; you can easily avoid that adding your booleans to the clicks so the user cannot go to the >level without having won the <ones.
THe reason of redundancy is my stupid brain cant think like a programmer…i should code it like when mouseOver, scale that button.png file … but i couldnt figure it out so i used the stupid way lol
and thanks for pointing out that bug! i just realized those mouseClickes WORK EVERY WHERE!!!
But i used ur code which worked perfectly…so i have a lead now…