Change the color of object when it touches a powerup

0 favourites
From the Asset Store
Create your own Behaviors in Construct 3 using events! Custom Expressions, Signals & Triggers Behavior Addon Pack
  • Hi, I would like to know how to change the color of a main object when it's in collision with another object.

    Here's the goal: the player controls a sphere of white paint and they have to touch one of the primary color powerup to change the color of the main character. It's like mixing two colors of paint.

    For example, the player directs the main object onto a yellow powerup. The protagonist is now yellow and, when directed to a cyan powerup, the former becomes green!

    Anyway, I've tried to make multiple sprites for each colors of the color wheel (primary, secondary and tertiary colors), destroy the previous transformation (ex.: destroy the yellow sprite) and spawn the new color mix (ex.: green). It's quite tedious and problematic.

    I learned that there's a way to change the color of the main object in the properties > effects > tint, but all of the colors are piling on top of each other just to create a black sphere.

  • Just create different animations for the protagonist and set the animation to match what's going on with the object pick up, you don't need to destroy the object.

  • Just create different animations for the protagonist and set the animation to match what's going on with the object pick up, you don't need to destroy the object.

    How do I change the animations for secondary colors? I did the following and this doesn't seem to work:

    Player|On collision with Cyan powerup|Set animation to "Green" (play from beginning)

    Player|Is animation "Yellow" playing

  • If it's not as simple as overlapping an object and changing to that colour then you'll have to draw something or provide a C3 file to look at because all I have to go off is that explanation in the original post and it's not 100% clear what you are trying to do.

  • If it's not as simple as overlapping an object and changing to that colour then you'll have to draw something or provide a C3 file to look at because all I have to go off is that explanation in the original post and it's not 100% clear what you are trying to do.

    First and foremost, thank you for answering me. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    I apologize if I'm unclear; I'm new to this. I don't fully grasp the concept of overlapping. What is it exactly?

    Second, I believe that it will be easier to explain with pictures and videos.

    Here's a demo of the unfinished game: youtu.be/IYtUQbj4rIA

    Here's the screen captures of my event sheet and main layout:

    imgur.com/a/aB9M1

    Have a good day (or night)! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

  • Hiya, could you explain what the issue is with the game in the video? It looks like it is doing what I would expect it to do, you overlap yellow and he turns yellow etc. Overlapping is simply checking when the collision polygon of one object overlaps with the collision polygon of another, the 'is overlapping' condition is true when that overlap occurs.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hiya, could you explain what the issue is with the game in the video? It looks like it is doing what I would expect it to do, you overlap yellow and he turns yellow etc. Overlapping is simply checking when the collision polygon of one object overlaps with the collision polygon of another, the 'is overlapping' condition is true when that overlap occurs.

    Hello, in the beginning of the video, the player touches the Blue powerup. Then, the now blue player should be green when they touch the yellow powerup. Blue + yellow = green, like mixing real paint!

    Have a good day

  • Oh okay, I find it better to have the colour as a variable on the player and then set the animation based on the variable name. I have made you a file here to demonstrate it, if you have any problems let me know.

    https://www.dropbox.com/s/sc2tlsffl50jt ... 1.c3p?dl=0

    Your events look ok but that would only work if you were overlapping the blue circle when your animation is yellow. In the video you are overlapping the yellow circle when your animation is blue. Possibly you are saying that change in animation to green was not working, there could be another reason for that. Check out my logic anyway it should help you with the use of conditions.

  • Oh okay, I find it better to have the colour as a variable on the player and then set the animation based on the variable name. I have made you a file here to demonstrate it, if you have any problems let me know.

    https://www.dropbox.com/s/sc2tlsffl50jt ... 1.c3p?dl=0

    Your events look ok but that would only work if you were overlapping the blue circle when your animation is yellow. In the video you are overlapping the yellow circle when your animation is blue. Possibly you are saying that change in animation to green was not working, there could be another reason for that. Check out my logic anyway it should help you with the use of conditions.

    First and foremost, I want to thank you for taking the time to make a file for me! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" /> However, it might just be me, but the player transform into tertiary colors when they're blue/red/yellow. For example, when the player is yellow and touches the blue powerup, they become teal (blue-green)

    Here's the game in question: 1drv.ms/u/s!Avdx1jR_xUQngbRtUqm14Aw_P1-3QA

  • Hi no problem I'll try and explain it the best I can. Basically when you are yellow and touch the blue, it changes your colour to green yes, but because you are still overlapping and your colour changed to green it instantly makes true the overlapping blue while green, so changes to b.green. If you disable the events for the tertiary you will see that secondary now works as expected. You will need to add some logic so that it checks one time for the overlap! Or you can do it a number of ways, only change to secondary colour on first overlap, wait for the player to no longer overlap, then change a variable that allows for tertiary combination. If you can't work out something then let me know, I can see what logic could do it if I have the time.

  • Hi no problem I'll try and explain it the best I can. Basically when you are yellow and touch the blue, it changes your colour to green yes, but because you are still overlapping and your colour changed to green it instantly makes true the overlapping blue while green, so changes to b.green. If you disable the events for the tertiary you will see that secondary now works as expected. You will need to add some logic so that it checks one time for the overlap! Or you can do it a number of ways, only change to secondary colour on first overlap, wait for the player to no longer overlap, then change a variable that allows for tertiary combination. If you can't work out something then let me know, I can see what logic could do it if I have the time.

    Hello plinkie! I don't think I fully understand what you mean...

  • The problem or the fix for the problem? Better to take it into a PM with me as this will just spam the thread and I don't know if you are beginner.

  • The problem or the fix for the problem? Better to take it into a PM with me as this will just spam the thread and I don't know if you are beginner.

    Probably more useful continuing here so other uses can maybe learn from the discussion.

    Your choice, obviously. Just my 2.452144 cents.

  • The problem or the fix for the problem? Better to take it into a PM with me as this will just spam the thread and I don't know if you are beginner.

    Unfortunately, I cannot PM you beause of a lack of Rep points. I'm the definition of a beginner; never designed a game before this!

    I understand the problem (I actually figured it out after my last message), but I don't really know how to fix it!

    Have a good day!

  • > The problem or the fix for the problem? Better to take it into a PM with me as this will just spam the thread and I don't know if you are beginner.

    >

    Probably more useful continuing here so other uses can maybe learn from the discussion.

    Your choice, obviously. Just my 2.452144 cents.

    True I can continue it here, I explained the potential fix and will come up with one although i can't always guarantee that my shared files will be around forever.

    > The problem or the fix for the problem? Better to take it into a PM with me as this will just spam the thread and I don't know if you are beginner.

    >

    Unfortunately, I cannot PM you beause of a lack of Rep points. I'm the definition of a beginner; never designed a game before this!

    I understand the problem (I actually figured it out after my last message), but I don't really know how to fix it!

    Have a good day!

    I will look at a fix today for you, I think I know what it will consist of, a variable that decides the tier of colour and only becomes applicable once you stop the overlap.

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