I cam across a PVZ project which seemed abandoned, so for fun I wanted to redo and complete it over the holidays.
The Problem: I have a bit of block code which deals with the interaction between Torchwood, and peas fired from Peashooter and Repeater. A majority of the time it works, it becomes a flaming pea, but sometimes the pea passes straight through, and I can’t figure out why. I even tried adding an invisible sprite in front of torwood to light any peas that weren’t initially lit, and that didn’t seem to work Either…
Have you seen the code? It’s one of those "On sprite of kind A overlaps with othersprite of kind B " blocks, I can’t put that inside a forever or game update block, or at least I wouldn’t know how to do it…
The only thing that I can see is that the switch only happens if the projectile’s z-index is zero. Is there any reason why any of those projectiles would have a z-index that isn’t zero before they hit the torchwood?
Try moving the repeater out of the way and see if the single shooter always works. Then swap them and see if the repeater always works. There might just be something weird happening only when they’re both firing.
I’ll try digging into this tonight, too, after I get home from work.
I was changing the projectile’s z-index as a modifier for an individual projectile, as I wanted projectiles that have been set on fire to deal an extra 20 damage. I also had both the peashooter and repeater in the same lane because I was testing if the torchwood could handle a larger amount of projectile interactions.
The Ïf projectile z-index = 0 then"block was there because I was originally changing its index by one, which I later changed to just setting it to 1. This made the if block obsolete, and after I removed it, all projectiles would be lit with no problem! The only slight issue I had after that was that the animation would continuously reset until it finally passed the torchwood. Still, I fixed that by having a small sound effect play at the end of the code so that it will have already passed the torchwood by the time the code tries to run again (resetting the animation).
Thank you! I wouldn’t have been able to fix it if you didn’t mention the z-index!
There was a variable that said “projectile” instead of dragging down the “Sprite” inside the block “On Sprite kind Projectile Overlaps with Sprite kind Torchwood at location”.