How do I make sprites random color?

0 favourites
  • 8 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • How do I make sprites random color when start layout?

  • You can use WebGL to tint them... But it won't work for all platforms...

    [attachment=0:tr648cs3][/attachment:tr648cs3]

  • You have two options with this I believe. The best one that should work everywhere is to create all your sprites in every possible color you would need and to upload them in to your project. You then change it to that animation when you need it.

    Your other option which will only work if you have WebGL available to you is to use one of the built in C2 Effects such as "Set Color." This will allow you dynamically change your RGB channels through the Effect. If your project defaults back to the Canvas2D this wont work though. So the first method is probably the safer method to guarantee it works.

    If you have many frames with different colours:

    On start of layout:

    Action:

    1. Stop 'sprite' animation

    2. Set frame to choose(1,2,3,4,....N) etc

  • Look up rex_rainbow's "Bejeweled" demo. He uses animation frames of various colors, then uses "random(Sprite.AnimationFrameCount)" to set the frame to a random frame (after setting the animation speed to 0 of course).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Added an example above...

  • I was just about to ask this question in the forum, although I kind of already knew the answer cause sprites are so static. I hoped to be wrong but by reading the above I know for sure now that this cool idea is not possible either. Encountered too many of those now.

    Construct is an awesome piece of software but too many things you can't do in it drags it down a bit unfortunately.

  • I was just about to ask this question, good that I searched for it first. Understand now that this is not possible either. Encountered too many of those now.

    Construct is an awesome piece of software but too many things you can't do in it drags it down a bit unfortunately.

    I'm not sure what you mean by Construct2 can't do it?

    There's at least two options: animation frames or webgl effects..

    Depending on the platform you want to export to you'd have to choose the right one..

  • I'm talking about randomizing or setting the RGB values from 0-255. I have a situation right now where I've created many different sprites to achieve the sense of random colours but at the end they all feel very static after a while. WebGL as someone above said doesn't work on all platforms.

    There's at least three huge benefits with this.

    1. You only need one image. More efficient and smaller sized games in memory and disk.

    2. You get true random colours. Reduce the effect of a static and boring impression from a player perspective.

    3. Less work in creating and sorting each image for each colour.

    It doesn't feel that this should be hard to implement in the software, correct me if I'm wrong.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)