Multiple objects instances tracking

0 favourites
  • 5 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • I'm creating objects every second, two types, both of them spawns (potentially) infinite objects:

    Is touching objectOne

       - Set Touched = 1

       - set t_TouchX_s = Touch.X

       - set t_TouchY_s = Touch.Y

    On touch end && Touched == 1

       - Set Touched = 0

       - set t_TouchX_e = Touch.X

       - set t_TouchY_e = Touch.Y

       - objectOne Physics Force distance(t_MouseX_s, t_MouseY_s, t_MouseX_e, t_MouseY_e) toward (t_MouseX_e, t_MouseY_e)

    This applies the force to ALL objects of that type. How can I make it that it applies the force only to the one I originally touched. I understand that I could set the UID in a variable, but that would mean destroying the multi touch! And things gets a lot more complicate since I have two types of objects.

    Anyone has a solution?

    Thanks

  • Bump?

  • it is allways a very good idea to provide your CAPX....

  • I don't have a multi-touch device so I can't fully test this but here is an idea of how to distinguish between multiple touches. It uses sprites to keep track of the positions of the touches and what objects were initially touched.

    http://dl.dropbox.com/u/5426011/examples%208/multitouch.capx

    Edit: Since I can't test it I can't be sure but you may need to add a "for each Sprite" condition to the top of event 4.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think for a "flick" type of control you could just use an instance variable, like sprite.variable("wastouched")= 1, sprite go to this vector.

    Then you would need another variable to tell if the object was still moving, and then once it stops moving set wastouched to 0.

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