Scrolling the texture of a sprite

Hi!

Is it possible to change the texture coordinates within a sprite to create a “scrolling effect”? I have a seamless texture that I would like to repeat wherever the player moves.

1 Like

Hi, Anton. Absolutely. You can create a new material and shader to accomplish this. Check out the materials documentation here: http://www.defold.com/doc/materials

You can copy the default material for sprites from the “builtins” folder and use that as a starting point. Don’t forget to set the Sprite’s material to the new one in the sprite properties.

2 Likes

I see, thx!

Another question if I may. Particles don’t seem to care about depth, they render on top no matter what. Am I doing something wrong?

That’s correct. The default render script renders the particles predicate like that. But you can change that behaviour with a custom render script. Check out http://www.defold.com/doc/rendering