How to change color of sprite over time

21 views
Skip to first unread message

Chipairon

unread,
Jul 15, 2016, 3:59:29 PM7/15/16
to melonJS - A lightweight HTML5 game engine
Hello,
I am just starting to learn this library and am very happy so far :)

I am a bit stuck with the following problem:

I want to add some trail effect to a moving object that will fade over time. This is what I've got so far:

(move with WASD or arrow keys)

Demo: https://chipairon.github.io/melonjs-trail/build/index.html
Source: https://github.com/Chipairon/melonjs-trail/blob/gh-pages/js/entities/entities.js#L70

But I want to change the colors of the items in the trail in the same way the fading is done.

In phaser this could be done tinting the sprite, but I have no clue about how to achieve that on melonjs.

Note: if the effect can be done with basic shapes instead of images that will work too.
Note2: if there is a better way of doing the trailing that using the tweening, please lead the newbie.

I have posted the question also in Stack Overflow:
http://stackoverflow.com/questions/38404011/how-to-change-color-of-a-sprite-over-time-in-melonjs

Reply all
Reply to author
Forward
0 new messages