I’m having trouble getting my pooled particle effects to follow their intended targets. My issue is that the particle effects fire off at stationary positions without updating their x/y coordinates. I’m working with a 2D game where players fire projectiles at each other, and I need the particles to stick to the origins of the “hit” player objects throughout the particle effects entire duration.
-
My setup is a World class which handles all object creation, and keeps track of object locations and status updates. The world class also handles collision detection between objects.
-
I also have a Render class which just works to render all animations for every object from the World class. The particle effects are updated here.
My issue right now is that when I detect collision in my World class, I need to fire off a particle effect from my Render class. To do this I send the coordinates of the collision from my World class, to my Render class, and have the Render class fire off the particle effects. Because of this setup I only get a single instance position of where the particle effects need to be, but not the updated location of the players location. This effectively makes it look like the particle effect is lagging behind the players updated location. What I’d like is for the particle effect to follow the updated location of the player, but I’m having trouble brainstorming of a way to do this.
Any suggestions?