phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.18k stars 7.1k forks source link

particle track #6582

Closed vuejspyf closed 1 year ago

vuejspyf commented 1 year ago

Is there an API in PhaserJS that can be used for particle tracking? Currently, I want to emit a particle towards object A (assuming object A's coordinates are (100,100)), but object A may move during the particle emission process. For example, object A moves 100px to the right (resulting in the final coordinates of A being (200,100)). As a result, the particle does not hit object A because it only moves to the predetermined coordinates (100,100). Is there any way to ensure tracking so that the particle will hit object A regardless of its movement?

image Here is an example of my game. I am developing a match-3 game, where the green spider egg is used to eliminate gems below the fragments. The green spider egg emits particles on the right side. These particles should hit the gems below the special gem on the left side (the gem that, when moved to the bottom, leads to victory). If the player does not move the gems below, the particles should accurately target the green arrow gem. However, if the player moves the gems below and the gem fragments slide down, the particles cannot track the gems below the fragments. Is there any way to track the position below the gem fragments? I have tried using "start" and "end" settings, but they do not achieve real-time tracking and updating.

photonstorm commented 1 year ago

See https://labs.phaser.io/view.html?src=src%5Cgame%20objects%5Cparticle%20emitter%5Cmove%20to%20dynamic.js

vuejspyf commented 1 year ago

See https://labs.phaser.io/view.html?src=src%5Cgame%20objects%5Cparticle%20emitter%5Cmove%20to%20dynamic.js

thank you i got it.