List of graphics created with created with scene.add.grapics?

Hi. How do I access the graphics I created with scene.add.grapics? Ie, to move them when I scroll the tilemap?

Thanks.

Why not store the value in variable, like: this.graph = scene.add.graphics();
You may access that variable after that

2 Likes

Hey, thanks for replying. Of course you can always do that, but wanted to know if there is a “Phaser way” of accomplishing that.

One Graphics object is like one drawing surface. You can draw as many shapes as you want on it, but it doesn’t really store those shapes. For persistence, you can create Geom objects, draw, update the Geom objects, clear, and redraw.

What are you trying to do, though? A Graphics object should already move with the camera. Or you can move it directly by setPosition() etc.