How do I Test if 2 sprites whenthey collide,have same color?

0 favourites
  • 13 posts
From the Asset Store
HSV RGB Color Picker and Converter for Construct 3
  • How do I Test if 2 sprites when they collide,have same colors?

    In few words.... i need to test if 2 sprites when are overlapping....and/or one on up each other.have same colours and ..i need to return true or false...

    Is there a plugin...or function in construct2 to do this???

    I thank you so much in advance.......

    best regards,


  • You can't check the sprite colour by default, but i guess the sprites had different animations so you can check them for example if sprite playing animation blue and other playing red then do something, or add a value that indicates the colour and set it when object is created, or you can add an effect "replace the colour" and check it's rgb, but it is laggy.

  • Dear Sisyphus,

    i thank you so much, but if you can are you be able to show me with a capx your idea example?.....because...i'm a beginner and i don't know where i must start....

    Or if there's someone else who can help me , i will thank you in advance...

    Best regards,


  • Use instance variables and compare?

  • fasasoftware

    You want to create puzzle game don't you?

    here the demo with the source:

    There is a event that cover how to detect 2 or more instances with same color in my example, simple approach

  • hope this help is not the best code but you will understand i hope

    alextro great stuff!!

  • Dear Friends......

    There's no words to thank you!!! Now i'll take a look about your demo capx examples.....and then i 'll feedback with you...

    Thousands Thanks To Everybody!!!


  • Dear kossak,

    I have tryed to open your demo software"same color.capx" but ...the system says to me that you have made with a newer version the 176 beta new release.....i use the 173 stable release......can you so kind to convert your software for the 173 stable release??? i thank you so much.....

    Best regards,


  • you can open it by opening the capx with an archiever like winrar and then edit the .caproj, there is something like saved with version, change it to your version and you will be able to open it

  • Thanks a lot fldr......

    I'll do....thanks again for your support....

    Happy Summer To Everybody!!!


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • fldr where is ? maybe another time because i cant find

    <?xml version="1.0" encoding="utf-8" ?>
        <name>New project</name>
            <plugin author="Scirra" id="Sprite" version="1">Sprite</plugin>
            <plugin author="Scirra" id="Text" version="1">Text</plugin>
            <plugin author="Scirra" id="TextBox" version="1">Text box</plugin>
        <used-behaviors />
        <used-effects />
            <configuration exporter-descname="HTML5" exporter-id="html5" name="HTML5" />
            <prop name="Clear background">Yes</prop>
            <prop name="Downscaling">Medium quality</prop>
            <prop name="Enable WebGL">On</prop>
            <prop name="Fullscreen in browser">Letterbox scale</prop>
            <prop name="Fullscreen scaling">High quality</prop>
            <prop name="Loader style">Progress bar & logo</prop>
            <prop name="Orientations">Any</prop>
            <prop name="Pause on unfocus">No</prop>
            <prop name="Physics engine">Box2D web</prop>
            <prop name="Preload sounds">Yes</prop>
            <prop name="Preview browser">(default)</prop>
            <prop name="Sampling">Linear</prop>
            <prop name="Use high-DPI display">Yes</prop>
        <object-folder expanded="1">
            <object-type name="Sprite" sid="5116692846491035">
                <plugin id="Sprite" />
                    <instance-variable name="color" sid="9746322920607333" type="string" />
                    <instance-variable name="id" sid="2015740291466653" type="number" />
                <animation-folder expanded="1">
                    <animation framecount="2" loop="0" name="Default" pingpong="0" repeatcount="1" repeatto="0" sid="9711695559715845" speed="0">
                        <frame duration="1" hotspotX="0.5" hotspotY="0.5" />
                        <frame duration="1" hotspotX="0.5" hotspotY="0.5" />
            <object-type name="TextBox" sid="5555530367750661">
                <plugin id="TextBox" />
            <object-type name="Text" sid="6681593308728346">
                <plugin id="Text" />
            <object-type name="Text2" sid="2053243861294757">
                <plugin id="Text" />
        <families />
        <layout-folder expanded="1">
            <layout>Layout 1.xml</layout>
        <event-folder expanded="1">
            <event-sheet>Event sheet 1.xml</event-sheet>
        <global-instances />
        <sounds-folder expanded="1" />
        <music-folder expanded="1" />
        <files-folder expanded="1">
            <file-folder expanded="0" name="Icons">
                <file name="icon-16.png" />
                <file name="icon-32.png" />
                <file name="icon-114.png" />
                <file name="icon-128.png" />
                <file name="icon-256.png" />
                <file name="loading-logo.png" />

    fasasoftware just donwload the last beta version i had the same problem when i was learning

  • 11th row in the code you posted, change 17600 to whats written in one of your caproj's, i guess 17300 but better just look into one of your caproj's

  • Dear Kossak,

    thank you for your Capx same color example....i saw it... but i don't understand the example,,,,in other words... i don't see any test of sprite if they are collide or not... you put a random color or blue or red....ok... but i'm sorry i don't understand....

    My idea is to test if two sprite or images are the same color but are always sprite if they are one up one each other(i think collide expression) then do something... like play a sound.....for example....much simple.....

    I'm so sorry....for my misunderstanding.....but this piece of code for me it's very important... i thank you again for your time dedicatetd to me....

    Best regards,


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