How do I test the color in a specific location....

0 favourites
  • 11 posts
From the Asset Store
Soldier Test
$9.99 USD
A Construct version 2 & 3 "Stand-alone" RPG game with "In-Game Module" (IGM) integration.
  • Dear friends..i have a problem.... i don't know how to test the color in a specific location in a sprite....In other words...i want to test if in a sprite in a specific location is black or white...and then for example if the test is true make a sound...

    Is it possible without plugin?? or bheaviour??? Can i do Normally?? Or there is a plugin out there???

    Do you have a capx example???

    Can you help Me Please?? Because my new app is based on this...

    best regards,

    Lestroso

    http://www.fasasoftware.com

  • You mean something like this?

    If so, It's quite simple. Create two frames on a sprite, make one black, one white. Check the position of your sprite, if it is where it should change colors, update the frame and trigger the sound through the "Media" Object.

    Hope it helps.

  • I modified the capx above

    [attachment=0:35dz1wmr][/attachment:35dz1wmr]

  • Wow, amazing Wisdoms! Go with his, much cooler!

  • "how to test the color in a specific location in a sprite"

    I thought he wanted to know the colour of a sprite (or part thereof) at a particular location.

    The blending stuff is cool though..

  • Dear friend thanks a lot ...but this is not for me the right solution.... i'm perhaps not well explain me...

    I'll try again...if you can help me.....

    Ok.. i need to test inside a sprite and/or image the color of a single pixel in a location always inside the sprite or image that i decide i, to know the value in number...255,255,255 or the value in color ...for example ..black or white ... etc..

    Ok now it is clear... i'm sorry for the confusion....

    any capx again?? Thanks a Lot in advance....

    Lestroso

    http://www.fasasoftware.com

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's what I thought. I haven't done it, but maybe check the Canvas plugin

    ?

  • dear codah,

    can you help me please if you have already done it???? i will thank you so much.....have you a capx example to retrieve the color pixel in a specific location???

    thanks again so much....

    Best regards,

    Lestroso

    http://www.fasasoftware.com

  • dear codah,

    can you help me please if you have already done it???? i will thank you so much.....have you a capx example to retrieve the color pixel in a specific location???

    thanks again so much....

    Best regards,

    Lestroso

    http://www.fasasoftware.com

    Sorry, I have not done it. Check the canvas plugin docs.

  • Many Thanks To Everybody!!!!

    The Canvas-Plugin Creator wrote to me this detailed Instructions....AND Works Thery Fine!!!! Thanks Again...

    Here The steps:

    1

    Create new project

    2

    Add mouse, text, and canvas objects

    3

    Give the canvas object an image and position it at 0,0

    4

    Go to the event editor and add a "every tick" condition.

    5

    Add the action: text-> set text to canvas.rgbaAt(int(mouse.x), int(mouse.y))

    6

    Run it and the text object will tell the color under the mouse on the canvas object.

    Extra tidbits:

    Int() is used since mouse.x can give values like 10.5 when window scaling is used and the value needs to be a whole number.

    .rgbaAt uses x and y values relative to the top left of the canvas object. So if you moved the canvas object from 0,0 you'd have to change the expression to:

    Canvas.rgbaAt(int(mouse.x-canvas.x), int(mouse.y-canvas.y))

    Finally notice it only gets the color from the canvas' own texture. Use the drawing actions to change this texture.

    Thanks A Lot Again....Cheers!!

    Best Regards,

    Lestroso

    http://www.fasasoftware.com

  • This is great thanks.

    I wonder how can I check if the specific point's rgba equals to some specific rgba ?

    I mean I want to check if (127,50) location's color is rgba(127,127,127,1) or not.

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