How do I Set The Background Color On Runtime

0 favourites
  • 7 posts
From the Asset Store
A whole set you need to create a gorgeous winter 2d game
  • 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

  • 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

  • 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

  • you can use canvas object and change it using this expression --> "rgb(xxx,xxx,xxx)"

  • puntodamar Where can I find canvas object please?

  • puntodamar found the plugin thank you very much

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you're welcome

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