Hi everyone! I think, given the tongue-twisting circumstances, the name of this post is as clear as it can be.
For some context, in my 2D top-down game I have a “Props” group that contains the “Chair” object and “Plant” object. These are props for the scene that the player can pick up and throw. The player can also hold the right mouse button to super charge the power bar, and when the button is let go, the variable isMaxxed of the thrown prop is set to true. When this happens, the thrown prop should be deleted when they hit anything (like boundaries or enemies, which works in separate events), and a prop that were to be hit by this object should get damaged. Right now, I’m trying to get the engine to pick whatever props object the chair is colliding with so that I can damage it, reducing its lifeProps variable (currently it’s just deleting it). However, the game keeps selecting the thrown chair instead of the collided props. Here’s the current code:
I tried doing multiple takes on this idea, but none of them worked:
Some of them are more detailed since they have the “right” logic and what the code should do (sounds, particles, health). The most recent ones are the most basic (they delete props to see if the game picks the right object). And they get more desperate, too.
So why does “delete Props” delete the Chair object when it should be deleting the Props object (Chair or Plant) that Chair is colliding with? And how can I get it to work properly? I’ve seen other people with a similar problem (with picking instances while using groups) but in different situations (like with the Bounce behaviour). Currently, I’m only trying with Chairs, but the plan is to also adapt (copy+paste) the logic to Plants.
Thanks for reading!