0 Favourites

Help on multiple sprite touches

  • Hey guys

    I have been trying to figure this one out but I cant seem so here my situation.

    I have 2 sprites on screen that are touch controls. And depending on where I touch on the sprite they change their angle to touch.x + touch.y.

    so it setup like: is touching rightctrl: set redctrl angle toward touch.X(redctrl.x) , touch.y(redctrl.y).

    now when touching 1st sprite only they behave fine, but as soon as the 2nd one is touched the 1st sprite changes its angle to point at the 2nd sprite

    please help me guys iv hit brick wall here.

    and thank you in advance

  • Your saying the first touch is messing up your 2nd?

    I think you can reference a certain touch. (or possibly the last touch)

    I'll take a quick look in C2 if I can make a quick demo for you. (Let me know if I misunderstood)

  • Use Touch.TouchIndex to check which tap it is... (0 is the first tap, 1 is the 2nd and so on.)

    I was gonna make a demo, but I didn't have my phone handy to test it.

  • Hey guys

    I have been trying to figure this one out but I cant seem so here my situation.

    I have 2 sprites on screen that are touch controls. And depending on where I touch on the sprite they change their angle to touch.x + touch.y.

    so it setup like: is touching rightctrl: set redctrl angle toward touch.X(redctrl.x) , touch.y(redctrl.y).

    now when touching 1st sprite only they behave fine, but as soon as the 2nd one is touched the 1st sprite changes its angle to point at the 2nd sprite

    please help me guys iv hit brick wall here.

    and thank you in advance

    That sounds like you have two on-screen joysticks and left controller is moving when only the right one is being used. Is that what's happening?

    Please post capx, if possible. If not, please post a screenshot of the event sheet.

  • Gmoney you are pretty much on the money but happens to either. only the last joystick touched responds and 1st joy angle towards 2nd touch just like Antares said. I cant figure out how to use the touch id correctly.

    here is an example

    https://www.dropbox.com/s/h70wnvwx9hor0ej/touch%20joysticks.capx?dl=0

    thanks for the help

  • Is this what you were looking for? <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    https://www.dropbox.com/s/964upy26lu0ip ... .capx?dl=0

  • na it still behaving the same last touched joystick behaves fine but the 1st one touched will angle to last touch. thanks for having a look I'm having a little success using the drag and drop function instead, everyone seems to use that for angle based joysticks

    thank you for your help gmoney

  • You're welcome, nmf004.

    That's odd.. <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused"> I tested it on my mobile device, but didn't see the first controller being angled to last touch..

    Anyway, yes, please try drag and drop function instead. (I wish I could have been more help.)

    Oh, and this example has variables to not allow both controllers to be touched at the same time.. I tested it on my device but the result was the same.. <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    https://www.dropbox.com/s/rpfzeg7j4zn0k ... .capx?dl=0

  • Figured I would share with everone how I fixed it used the drag and drop and set instance variables to on touch start on object. That way it didn't update the touched and make the 1st joy angle to 2nd touch now just use, set angle of sprite to touch.xforid(instance variable) of your joy

    Probly sounds confusing so I provide an example

    https://www.dropbox.com/s/h70wnvwx9hor0ej/touch%20joysticks.capx?dl=0

    thank you gamoney and Antares for your help you inspired many, many different attempts

    btw if you have any issues getting your joysticks to angle in your game, on each of the set angle you have touch.Xforid(redctrl.touchid",layer to get touch position for") < simply change that number to the number of the layer your control's are on

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Figured I would share with everone how I fixed it used the drag and drop and set instance variables to on touch start on object. That way it didn't update the touched and make the 1st joy angle to 2nd touch now just use, set angle of sprite to touch.xforid(instance variable) of your joy

    Probly sounds confusing so I provide an example

    https://www.dropbox.com/s/h70wnvwx9hor0ej/touch%20joysticks.capx?dl=0

    thank you gamoney and Antares for your help you inspired many, many different attempts

    btw if you have any issues getting your joysticks to angle in your game, on each of the set angle you have touch.Xforid(redctrl.touchid",layer to get touch position for") < simply change that number to the number of the layer your control's are on

    You're always welcome, nmf004. I'm glad the issue was resolved.

    Thank you for sharing. I'll remember to use touch.xforid(instance variable) in the future.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,285
RetroDaddy's avatar
RetroDaddy
Unread hot topic
86 28,707
St4rDu57's avatar
St4rDu57
Unread hot topic
157 12,690
megatronx's avatar
megatronx