How do I change colours in the Drawing Canvas?

0 favourites
  • 5 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • I have a database that has saved 350 drawings from Construct 2. I have the X Pos, the Y Pos and the colour.

    Example - 256,720,black

    However, for some reason I can't get my head around, in Construct 3 I can no longer simply put in a colour. Instead, I have to have 256,720,rbgex(0,0,0).

    "Ok, that's fine," I thought, "I'll just set up a few events that will change black to the rgba codes."

    So I create a string variable, then if it detects "black" in the 3rd array, it'll change it to the rbgex code.

    However, that doesn't work because the Drawing Canvas can only work with numbers. If I try to put my new colour variable into it, it won't work.

    So I change the variable into a number instead. However, now I can't have "rgbex" at the start! In fact, I can't even use the commas separating the numbers!

    In the end I went back over to the string variable and used a tokenat expression.

    So... just to confirm:

    Construct 3 = rgbEx(int(tokenat(Drawing.Colour,0,",")),int(tokenat(Drawing.Colour,1,",")),int(tokenat(Drawing.Colour,2,",")))

    Construct 2 = black

    Give me a break! Please, someone tell me there's an easier way! I now have to go in and set this up for every colour I decided to use. Luckily for me, I only used about 9 colours, but what would I do if I had used more? Is there a smarter way to do this?

    I love Construct 3, but I'm hating this one step forward, one step back feeling I'm getting.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to extract the name of the color into a text variable, and then do something like this:

    .

    Or you can get the numerical values for all 9 colors and replace them in the database. For example, "blue" is -1049599

  • construct3.ideas.aha.io

    I agree it's not very useful at the moment.

  • You need to extract the name of the color into a text variable, and then do something like this:

    .

    Or you can get the numerical values for all 9 colors and replace them in the database. For example, "blue" is -1049599

    Thanks!

    That's what I ended up doing, but with that token expression. When I tried to write "rgbex(0,0,0)" or (0,0,0) into the number instance variable, it wouldn't let me. I didn't then think to simply write it in as an action.

    newt - https://construct3.ideas.aha.io/ideas/C3-I-1347

    Did this 2 weeks ago :D

  • I think what we need is a way to use palettes.

    The color tools are kind of a mess any way, not that there's a perfect solution.

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