HP bar green to red

Get help using Construct 3!

Post » Sun Jul 09, 2017 6:33 am

hey all since i was on c2 my code was working but then on c3 its not the samething anymore
how can i reimplement it ???

https://www.dropbox.com/s/kvlw55q55wbt3 ... .capx?dl=0
thats the download link
but i want it for c3 now
and i know that c3 now use rgb(255,255,255)

anyone cold remake me a script for c3 ?
B
29
S
9
G
3
Posts: 138
Reputation: 3,804

Post » Sun Jul 09, 2017 3:09 pm

kiugetski wrote:and i know that c3 now use rgb(255,255,255)


As you said, C3 using for setcolor only one parameter with rgb-values.

So you have to replace the two events 'set effect 'SetColor' parameter 0' and 'set effect 'SetColor' parameter 1' in C2
with one event in C3:
Set effect SetColor parameter 0 to rgb (255 - (smiley.HP / smiley.MaxHP * 255),smiley.HP / smiley.MaxHP * 150,0)

That's only the paramter 0 and parameter 1 from C2 on position 0 and 1 in the RGB-Value, position 2 is like the parameter 2 in C2 still zero.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Sun Jul 09, 2017 6:40 pm

O_o now im lost

can you make a working c3 project and send it to dropbox ?
because im working on otherstuff at same time for my game
B
29
S
9
G
3
Posts: 138
Reputation: 3,804

Post » Sun Jul 09, 2017 7:23 pm

@kiugetski

In C2 the SetColor Effect has 3 parameters R, G and B. In C3 it has only 1 parameter. You have to use the rgb-command with the same 3 parameters as values.

In C2 it looks like that:
Image

Parameter 0 has the value: 255 - (smiley.HP / smiley.MaxHP * 255) that is your R(ed) value.
Parameter 1 has the value: smiley.HP / smiley.MaxHP * 150 that is your G(reen) value.
Parameter 2 has the value: 0 You don't set any B(lue) value.

In C3 there is only one parameter for SetColor but that expects a rgb-value rgb(R,G,B). So you have to set the parameters from C2 as values in the rgb-command:
rgb (255 - (smiley.HP / smiley.MaxHP * 255), smiley.HP / smiley.MaxHP * 150, 0)

In C3 it looks now like this:
Image


The example as c3p:
https://drive.google.com/uc?export=down ... llZSGlEVTQ
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Sun Jul 09, 2017 8:01 pm

oh ok so instead of having 2 line with set color its just one now
B
29
S
9
G
3
Posts: 138
Reputation: 3,804


Return to How do I...?

Who is online

Users browsing this forum: No registered users and 1 guest