jatin1726's Forum Posts

  • Do you mean color name like "blue" or "yellow"? There is no such expression. You will need to write a bunch of events, something like this:

    > Compare variable R>200
    Compare variable G<50
    Compare variable B<50
    			 -> Set colorName="Red"
    
    else
    .....
    

    Something similar sort but comparing variable and then naming is tedious job bcz there are millions of combination and color names possible with 3 RGB values. iS there any way to find out the name by comparing to some database or text file? Also, I noticed that color detected on tap is completely wrong on mobile device but little bit accurate on desktop. Is there any way to increase accuracy of the color detected on tap? And I still want to thank you a lot for showing this possible solution. I was in big need of that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You didn't replace the Canvas object in the project and you didn't do any of the things I suggested!

    1. Remove Rex's Canvas from the project, better uninstall it completely.

    2. Add R0j0hound's Canvas object to the project, set its size 1x1px

    3.

    > Touch On Tap Sprite
    	: Canvas set position to touch.x, touch.y
    	: Canvas paste object Sprite
    	: Text set text to "Red: " & Canvas.redAt(0,0) & " Green: " & Canvas.greenAt(0,0) & " Blue: " & Canvas.blueAt(0,0) 
    

    Thank you dop, it worked flawless and i am able get rgb of the tapped pixel now. Is there any way that i should color name also from the rgb? is it even possible to get color name ?

  • You installed the wrong plugin. You need Canvas by R0j0hound:

    https://www.construct.net/en/forum/extending-construct-2/addons-29/plugin-canvas-41782

    I updated plugin but same thing. This is new capx

    vserv-images.s3.amazonaws.com/adsunit/capx/testcolorcopy2.capx

  • You can retrieve the Color property of an object with the ColorValue expression.

    Hi Ashley, can u please explain how to use that color value expression? I am also in desperate need of the same.

  • Set Canvas size to 1x1 pixel, on click/tap position canvas to that point. Then use "Canvas paste object" or "Canvas paste layer", depending on your needs.

    After that you will be able to get rgb values from Canvas expressions: Canvas.redAt(0,0), Canvas.greenAt(0,0), Canvas.blueAt(0,0)

    I tried something but dont know thats the result. here is my trial capx. Plz help

    vserv-images.s3.amazonaws.com/adsunit/capx/testcolorcopy.capx

  • You need Canvas plugin - put a small Canvas object under the mouse cursor, paste all layers onto it, then you will be able to read pixel color from the canvas. You can probably do this easier with Javascript, but I can't help you with this.

    https://www.construct.net/en/forum/extending-construct-2/addons-29/plugin-canvas-41782

    Hi Dop, thanks for quick reply, can you please share an example in which I can understand that how to extract color of the pixel(using canvas plugin) touched/tapped, then it will be big help for me. Also I have another curosity, can we do the same using webcam picture and tap on the cheek to find out color of skin? canvas plugin could do that?

    Regards,

    Jatin

  • Hi Friends,

    Need urgent help. Is it possible to find out color of touched/tap area of finger touch?

    Thanks in advance.

    Regards,

    Mohan

  • How did you calculate the lX and lY camera position on the mode7 plane?

    I have rewitten the shader and the perspective behavior, to allow changing camera height and scalings in realtime. Not hard at all.

    But im struggling to get the camera to an absolute position over the ground.

    Hi, can u plz tell me how u did that camera scaling thing, a tutorial will be so helpful.

  • These id1,id2,etc.. are actually IIDs. If you only have 2 instances of the object on your layout, their IIDs will be 0 and 1. So you can use:

    distance(Sprite(0).x, Sprite(0).y, Sprite(1).x, Sprite(1).y)

    .

    If you have many instances and need to know the distance between any two, you'll need to find their IIDs first.

    Alternatively, you can create a family with this sprite and do this:

    > Pick Sprite instance
    Pick Family instance
    if distance(Sprite.x, Sprite.y, Family.x, Family.y) ....
    

    Thanks DOP, this way worked for me. Now I can calculate distance between two points now.

  • distance(sprite(id1).x,sprite(id1).y,sprite(id2).x,sprite(id2).y)

    How you assigning id1 etc to your sprites?

  • distance(sprite(id1).x,sprite(id1).y,sprite(id2).x,sprite(id2).y)

    Hi Friend,

    I tried above solution but it not taking the function.

    My code is below.

    distance(Dot.IID(63).X,Dot.IID(63).Y,Dot.IID(67).X,Dot.IID(67).Y)

    DOT is my sprite name and for ID im taking IID.

    Regards,

    Jatin

  • Hi Friends,

    Need a help. In my game, objects a and b (of same type) are created.

    How can I find distance between the two objects each time so that when they are closer than 50 px they will blast. (I am using object.IID instead of object.UID)

    Regards,

    Jatin

  • What do you mean by "not responsive"? To scroll with mouse - On mouse wheel move the panel some distance up or down.

    I don't know how you display the weather, probably send a http request to some weather web service via AJAX, then parse the response.

    Hi Dop, with 'not resposive' means that the thumbnail size tries to auto fit as per the availalbe resolution. as css media queries does the work.

  • Hi Friends,

    I am looking for this following plugin which can import .obj 3d model into construct 2 and that 3d model could be rotated scaled etc. Could anyone please share if you have the plugin or alternative plugin (please don't suggest q3d it is already dead and hardest to even start)

    More info about plugin:

    construct.net/en/forum/extending-construct-2/addons-29/plugin-object-3d-alpha-0-3-44869

    Regards,

    Jatin

  • The correct way to parse response from the weather server is to feed it into JSON plugin, but if you only need to retrieve a couple of values, you can use this method:

    https://www.dropbox.com/s/n8oo19a0aa2bauu/WeatherData.capx?dl=0

    If this doesn't work in preview mode, open browser console. If you see "Origin localhost is not allowed by Access-Control-Allow-Origin" or similar error there, this is CORS issue, search the forum for solutions.

    Dop, right now I am feeling like you are savior god for me. This worked exactly as was my requirement. Thanks a ton ton and tons. God bless you in everyway you wish. You r the best.