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

0 favourites
  • 14 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • Hi, following my former request about zoom to pinch, i finally made an implementation (well, sort of).

    But i have more questions now : <img src="smileys/smiley2.gif" border="0" align="middle" />

    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 !

    dropbox.com/s/h4qh9tbetww7vg5/bn.capx

    TheMac

  • Bump !

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

    TheMac

  • 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.

  • 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

  • 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?

  • LittleStain

    I do have paid version (via steam....gulp...but it works well <img src="smileys/smiley2.gif" border="0" align="middle" /> ).

    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

  • I saw your capx.

    I would advice you to try and use smaller sprites and/or cut them up into smaller pieces.

  • LittleStain

    Thanks !

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

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

    TheMac

  • LittleStain

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

    Thanks.

    TheMac

  • 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..

  • LittleStain,

    i tried your solution (one sprite, with different animation frames. Thus i'm able to identify WICH frame is clicked.

    Everything works perfectly, but....when i do my zoom (remember, zooming is ON SPRITE, not ON ANIMATION FRAME), every frame of animation of that sprite will be zoomed.

    Poor result

    Is there any WORKING solution ? Is there someone could finally resolve my problem ?

    Do you need a new .capx ?

    here it is : https://www.dropbox.com/s/76dkz24etct7y32/test.capx

    and by the way, old question : I can i test PINCH in browser ???

    Thanks !

    TheMac

  • Bump

    TheMac

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Added the piggy and the hunter to a family (Objects), select one first (touch) to activate it.

    Added rotating to the zoom action too, all in 1 go

    About point 1 ... I don not know what you consider strange, but I like it

    *assimilates*

    capx

    simply add all the objects which should be zoomable and rotatable to the "Objects" family.

  • Thanks ! So you did use the "system.pick object by evaluating "

    Very good implementation, exactly what i was looking for but couldn't figure

    i owe you one

    TheMac

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