Important request..

0 favourites
  • 13 posts
  • Adding option to prevent the mouse or touch plugins to click on sprites will be great.

    Now if you have disabled sprite collision, The mouse and touch can click on it, And you need to get around this by adding more events like delete or create sprite or activate and deactivate groups.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How would that work?

    On touch sprite, sprite stop touch of sprite?

  • Just Ignore sprites that have disabled collision.

  • But the touch object isn't associated with objects until they are touched.

    You can't say touch object ignore touch of sprite, and you can't say sprite ignore touch of touch.

    You can check a Boolean and if that value, or variable is false then any sub events, such as on touch, would be ignored.

  • Just Ignore sprites that have disabled collision.

    Just add it a viariable, boolean, true/false, and let it only be clickable when true.

  • Just a quick add. That's not what collisions are used for. They are used to handle the math on object on object collisions. Ideally you would disable collisions from hud anyway that they don't have to make any collision checks (hud rarery interacts with objects).

  • If i have Sprite buttons that i don't want to be clicked, I need to use variables or deactivate groups, If the mouse can't click on disabled sprites this will be awesome and i don't need to add more events and variables to get around this.

  • But that's not how objects work. Touch doesn't know anything about sprite, just as tiled background doesn't know anything about the text object.

    It amounts to saying the same as keyboard ignore collision of sprite.

    The only way it could be done is if someone made a behavior you add to the object you don't want touched, and that would probably take a lot of code, where you can add a variable in one click, and add one event.

  • Touch doesn't know anything about sprite

    newt - That's not exactly true since there is an "On touched object" condition, so it must use the objects collision polygon and position to determine if the touch occurred in that area

    All I think A0Nasser wants is for On touched object to only return true if the object is touched while it has collisions enabled and always false if collisions are disabled, which only seems logical.

    Same goes for the Mouse On object clicked condition.

    The only way it could be done is if someone made a behavior you add to the object you don't want touched, and that would probably take a lot of code,

    It wouldn't take much code. All it would take is for Ashley to add in where On touched object/On object clicked normally returns true a check like this:

    if Object.isSprite then
       return Object.collisionsEnabled
    else
       return true
    end
    [/code:37d5gcfg]
    One workaround is simply to add in the sprite's [i]Collisions enabled[/i] condition in the events with the [i]On touched object/On object clicked[/i] condition, and turn on/off collisions as needed. [url=https://dl.dropboxusercontent.com/u/90589590/C2%20Examples/DisableCollsionsDisableTouch.capx]See example capx[/url]
  • And what if you did need to know if that object was touched?

    Touch, and collision are two different things.

    Having the extra layer just complicates things where the variable method, which is how most everything else works doesn't add much overhead.

  • OddConfection

    Thank's for the example.

    If the code is easy, then it will be awesome to see in the future.

  • A0Nasser, in this case I'd say it's way better to do variables/events to determine if an object should be allowed to be touched, than for Scirra to modify the Touch behavior.

    Can you upload a capx in the How Do I forum section for us to help you?

  • Thank's for the help offer.

    I can get around this by simply put the event's inside a deactivate group then activate it when i want to.

    But it will be great to see this request on the mouse and touch plugins.

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