Confused about block glitch/idk what is happening

link 2 game

hello, this is Blobiy, i was wondering about a weird glitch where some times you just win, but when you actually have the correct parameters it does not work.

there are zombies, and you have a gun. defend yourself by attacking, (a) and reload (b).
when you kill a zombie you get one point.

at the start there is a high chance you will win, the character will freeze (edit: fixed the freezing), or it will be played as normal. the issue is that i set it up in a function to make a certain num of zombies.
if you kill them all, (or they damage you and then disappear) you will have “killed” 17 of them, there is a boolean that tells me once each type of zombie is dead, and once all the zombies are dead then you should be able to win, but nothing happens,

plz help.

  • blobiy

Taking a quick look at the code, I think the issue might be here:

The three zombie variables (zombert, speedert, and armored) are only pointing to the last sprite that was created of that kind. So, if you have two zomberts on the screen, one will pass the comparison and one will fail depending on which was created first.

Instead, I’d recommend you use the sprite data extension you’re already using! Right now you are setting the “health” of the zombie, but you could also set a “zombieType”. Then you can check the “zombieType” in your collision handler.

omg, i knew about that and i was thinking that too, but then i was like, “nah, it got to be something else.” ugg, i knew i should have gone with my gut. Thank You!!!