selections within a sprite

This forum is currently in read-only mode.
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • What would be a quick/easy way to have a sprite with multiple "selection points".

    For example a circle with 3 smaller circles within.

    How does Construct know which small circle (within the big circle) I am clicking on?

    Thanks for answering advance.

  • I would think about using image points. In case of circles you could check the distance to the respective image points (having them places centered on the circles). The closest distance that's still in the radius of the circle would be picked. But you'd have to use PVs then too to set the radii.

    Or you could define rectangle shapes with PVs too, you'd need at least two values per area. One representing top left, the other bottom right position (X/Y and gettoken maybe).

    Actually what I'm talking about is more or less like image maps in HTML work, so you could adapt that if you're familiar with it.

    It's prolly better for any shape to just place contained invisible dummy sprites on the object. Again with image points.

  • I would think about using image points. In case of circles you could check the distance to the respective image points (having them places centered on the circles). The closest distance that's still in the radius of the circle would be picked. But you'd have to use PVs then too to set the radii.

    Or you could define rectangle shapes with PVs too, you'd need at least two values per area. One representing top left, the other bottom right position (X/Y and gettoken maybe).

    Actually what I'm talking about is more or less like image maps in HTML work, so you could adapt that if you're familiar with it.

    It's prolly better for any shape to just place contained invisible dummy sprites on the object. Again with image points.

    >On mouse click
    distance(sprite.imagepointx("a"), sprite.imagepointy("a"), mousex,mousey) < inner circle a radius [/code:wpfl5yjf]
    
    Should work, but your probably going to want some sort of visual representation, so using a dummy is better.
    
    Also I tried the get relative x,y, using a distortmaps get vertex,x,y, before.... no go tho.
  • You could also make them the same sprite/family, and when clicked on, use pick top-most.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the answers, I am going to try it.

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