How do i select a sprite using touch and zoom it ?

Get help using Construct 2

Post » Sun Feb 16, 2014 8:47 am

Hi, following my former request about zoom to pinch, i finally made an implementation (well, sort of).

But i have more questions now :

1) Is my implementation right ? Seems a bit "strange"

2) In "zoomSheet" sheet, i hard-coded instructions for only one sprite, named "HUNTER", but i need this rules applied to any of my sprite and obviously the zoom will be done ONLY on the selected sprite (i think that FIRST TOUCH select the sprite). How can i accomplish this ?

3) Can someone help me to add also sprite rotation in the sheet ?

Thanks in advance !



https://www.dropbox.com/s/h4qh9tbetww7vg5/bn.capx

TheMac
B
7
S
1
Posts: 38
Reputation: 491

Post » Mon Feb 17, 2014 7:40 am

Bump !

Lurked forum and docs, but still i haven't a clue :(

TheMac
B
7
S
1
Posts: 38
Reputation: 491

Post » Mon Feb 17, 2014 7:52 am

Basically you'd have to do something like this:

give the sprite a boolean variable "selected"

on touched sprite - toggle boolean

get the starting distance and the starting angle between the first and second touch.

then change the scale of the sprite according to the change in distance and set the angle of the sprite according to the change in angle.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 17, 2014 8:04 am

@LittleStain,

thanks for the answer, but doesn't seems to practical. I'll have, in finished version, more than 80/90 sprites. So i have to do 90 events "on touched" ?

And when i'm going to zoom/rotate, i'll have to do 90 "if 'is selected'" ??

I saw i can save (in a global variable) the UID of sprite. Can then use this sayng something like "sprite with this UID, do that.----"

Thanks.

TheMac
B
7
S
1
Posts: 38
Reputation: 491

Post » Mon Feb 17, 2014 8:11 am

Best way would be to use families, but those are only available in the paid version.

Why would you need 80/90 sprites when you all want them to do the same thing?
Wouldn't it be easier to use animationframes if they look different and if they look the same, just use instances?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 17, 2014 8:17 am

@LittleStain

I do have paid version (via steam....gulp...but it works well ).

Uhm...nice ideas !

So, the ideas are :

Group my sprites in a family (one or two families will be enough)
And then how can i'll see which of my sprite is selected ?

OR
Use ONLY one (or two) sprite. With 80/90 frames of animation ?

And then how can i can tell which animation of the same sprite is clicked ?

(they will all be different, both in pictures and in size, is that a problem ?)

Thanks, anyway i think i'm close ! Did you see my capx ?

TheMac
B
7
S
1
Posts: 38
Reputation: 491

Post » Mon Feb 17, 2014 8:55 am

I saw your capx.

I would advice you to try and use smaller sprites and/or cut them up into smaller pieces.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 17, 2014 9:20 am

@LittleStain

Thanks !

ok, you're referring to the "background" sprites ? i'll do it

And what about the "touch and select sprite" need ?

TheMacthemacvictror2014-02-17 11:17:04
B
7
S
1
Posts: 38
Reputation: 491

Post » Mon Feb 17, 2014 1:49 pm

@LittleStain

What i should insert in zoomSheet substituting "hunter" ? a global variable ? or the animation index ?

Thanks.

TheMac
B
7
S
1
Posts: 38
Reputation: 491

Post » Mon Feb 17, 2014 1:55 pm

If you put all the objects as animationframes, you could just keep using hunter if the sprite is so called.

If you put all in a family it would be wise to create a way to select the sprite you'd like to affect.

so pick family member for which selected is true or something like that.

You could probably also pick the family member which is closest to the fingers, for most people will work that way automatically..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: warmty and 9 guests