How do I: put a 'clamp' on two added numbers.

Get help using Construct 2

Post » Fri Nov 28, 2014 9:31 pm

Hi guys.
As the title suggests, I'm trying to find a way to stop two added values from going over a certain limit within the formula. Something like:

a+b=(not to go over 100)

Is it possible?

I'm basically trying to add RGB values together to create RGB mixes using 'tint'. So if I add:
Red=100,0,0
Blue=0,0,100
I get magenta: 100,0,100.

Further down the line I envisage the numbers being mixed totalling more than 100!
B
7
Posts: 33
Reputation: 341

Post » Fri Nov 28, 2014 9:39 pm

max(a, b [, c...]), min(a, b [, c...]) Calculate maximum or minimum of the given numbers. Any number of parameters can be used as long as there are at least two.

https://www.scirra.com/manual/126/system-expressions
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Fri Nov 28, 2014 10:09 pm

Yeah, I saw that while searching for a solution.
I'll be honest, I didn't understand it completely.

I realised, shortly after posting my question that my game plan probably wont work anyway.
Thinking out loud....
If i add red-100,0,0
to blue-0,0,100
I get magenta.
Theres no other combinations left other than adding green to magenta, giving white.
All values will be 100 and the game technically over.

I wanted to keep combining coloures, creating many different ones!!

What can I do?
B
7
Posts: 33
Reputation: 341

Post » Sat Nov 29, 2014 12:11 am

You've got a rang of 0 to 100 on each RGB channel, so there's plenty of colour options.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Sat Nov 29, 2014 9:52 am

I was thinking the way I've coded it is wrong.
B
7
Posts: 33
Reputation: 341


Return to How do I....?

Who is online

Users browsing this forum: Phacanu, sanjeev19jha and 7 guests