How do I make sprites random color?

Get help using Construct 2

Post » Wed Dec 17, 2014 4:35 am

How do I make sprites random color when start layout?
B
7
S
1
Posts: 36
Reputation: 501

Post » Wed Dec 17, 2014 5:41 pm

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

random-colors.capx
You do not have the required permissions to view the files attached to this post.
Last edited by brunopalermo on Wed Dec 17, 2014 6:05 pm, edited 1 time in total.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 417
Reputation: 2,315

Post » Wed Dec 17, 2014 5:51 pm

Xerullian wrote: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
Last edited by Richard521 on Wed Dec 17, 2014 5:56 pm, edited 1 time in total.
B
6
Posts: 8
Reputation: 266

Post » Wed Dec 17, 2014 5:53 pm

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).
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed Dec 17, 2014 6:05 pm

Added an example above...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 417
Reputation: 2,315

Post » Sun Jul 19, 2015 2:42 pm

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.
Last edited by Mr X on Sun Jul 19, 2015 2:47 pm, edited 1 time in total.
B
7
S
1
Posts: 37
Reputation: 509

Post » Sun Jul 19, 2015 2:47 pm

Mr X wrote: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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 19, 2015 2:53 pm

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.
B
7
S
1
Posts: 37
Reputation: 509


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, plinkie, rayolf and 10 guests