How do I change the color of only the newest instance of a sprite

Godot Version

Godot 4

Question

I’ve been trying to set a sprite such that each instance has it’s own color(based on a current variable) but every time, all the instances change color instead of just one.
I have no idea what to do.


It’s hard to tell what might be causing your problem from the information I’m seeing. However, I can think of some things off the top of my head.

  • In the docs CanvasItem.modulate effects child nodes as well, and instead self_module only effects the Node itself. I don’t think all your juice nodes are children of each other, but worth a shot.

Where is the r, g, and b of this juice script getting set?

Some other nitpicks

  • In juice.gd, I see that you’re modulating the color of a CanvasItem(?) every frame based on r, g and b. Instead of applying these values continuously, I’d suggest having a function to change the color of that CanvasItem.
  • The PackedScene you instantiate is not a Node, and naming it like that is a little confusing :slight_smile:
  • I’d recommend using codeblocks instead of screenshots when posting in the forum