iOS Touch Sprite Area?

Discussion in 'Programming' started by Jason C., Mar 12, 2018.

  1. Jason C.

    Jason C. Member

    Joined:
    Mar 12, 2018
    Posts:
    17
    Is it possible to enable a touch event on a sprite, but only if touched with a specific area within the sprite itself? I don't want the event to fire if the player touches the sprite outside the allowed touch area.
     
  2. Dupletor

    Dupletor Member

    Joined:
    Apr 22, 2017
    Posts:
    328
    Either change the collision mask or create a new object that fills this area.
     
  3. kevins_office

    kevins_office Member

    Joined:
    Dec 19, 2017
    Posts:
    224
    Or... can you get the touch xy like mouse xy in a touch event?
    Have the event fire if the object is touched anywhere, then inside that event check the xy location and if its outside of the area you want it to react with then exit the event without running the code you want for when they touch inside the correct area.
     
  4. Jason C.

    Jason C. Member

    Joined:
    Mar 12, 2018
    Posts:
    17
    Ok, so Collision Mask. I'm evaluating GM2, coming from Unity3D so I have this and other technical questions. Touch/Gesture Events can be peered with Collision Masks. I believe this is answer I needed. Same in Unity.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice