How do I Set The Background Color On Runtime

Get help using Construct 2

Post » Mon Jan 05, 2015 9:09 pm

Hello,

I have attached a .capx file for the game I am working which is similar to Amazing Theif game.
I can't figure out how to set random background color for bottomPipe and TopPipe which is being created every 1.4 seconds.
I want both of them to have same random color which are being created together then the other pair of pipes can have different random color.
Also I think the game lags a bit even on my browser and android device when I build it using Crosswalk via Intel XDK.
The frame rates are around 58 - 60 which is good but I still think sometimes it lags and the music doesn't play when it should be played.

Please let me know how can I work around with the color issue I mentioned above and about the lag.

Thank you
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 41
Reputation: 509

Post » Mon Jan 05, 2015 9:54 pm

I am not sure you can set objects to have random colours. you have your sprites with pre-defined colors. what I would suggest looking at your design is that you could have multiple frames for your objects (5x5 pixels, no need to be big) and then you can randomly select from the range of frames. I also do not think you need a top and bottom pipe, functionally they seem to be the same, just positioned differently.

It ran okay on my laptop on chrome at 40 fps at about 5-10%

PS: I did note that some random combinations of placements are impossible to overcome... so that makes the game a bit of a random chance game :(

PS: I love your running stick man :)
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Mon Jan 05, 2015 10:36 pm

@rho Thank you so much. It really makes sense, I should put different color sprites in frames and on every spawn it should select random frame to make it better. I will also change the size of Sprites to 5x5 and then scale them on runtime. I will also try to use one box as top and bottom box instead of using 2.

Thank you very much
B
7
S
1
Posts: 41
Reputation: 509

Post » Tue Jan 06, 2015 5:06 am

you can use canvas object and change it using this expression --> "rgb(xxx,xxx,xxx)"
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
64
S
14
G
2
Posts: 292
Reputation: 6,678

Post » Tue Jan 06, 2015 1:58 pm

@puntodamar Where can I find canvas object please?
B
7
S
1
Posts: 41
Reputation: 509

Post » Tue Jan 06, 2015 2:07 pm

@puntodamar found the plugin thank you very much :)
B
7
S
1
Posts: 41
Reputation: 509

Post » Wed Jan 07, 2015 1:14 pm

you're welcome :-)
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
64
S
14
G
2
Posts: 292
Reputation: 6,678


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 8 guests