selections within a sprite

For questions about using Classic.

Post » Fri Dec 31, 2010 2:59 pm

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.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Fri Dec 31, 2010 3:38 pm

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.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Dec 31, 2010 4:15 pm

[quote="PixelRebirth":wpfl5yjf]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.[/quote:wpfl5yjf]

[code:wpfl5yjf]>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.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Dec 31, 2010 4:22 pm

You could also make them the same sprite/family, and when clicked on, use pick top-most.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,422

Post » Fri Dec 31, 2010 4:50 pm

Thanks for the answers, I am going to try it.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests