0 Favourites

How do I use Mouse over object / On object clicked together?

  • Hi all,

    Testing a scenario where I have 3 mouse interaction states for an image, using animation frames, instead of the button object.

    Idle state: working

    Inverted Mouse: Cursor is over object, set animation frame to 0.

    Hover state: working

    used Mouse: Cursor is over object, set animation frame to 1.

    Clicked state: not working

    used Mouse: On object clicked, set animation frame to 2.

    The problem seems to arise because the clicked state does not override the hover state (if you can click the image, your cursor is definitely over the object). So hover state is always active in these 2 states. If I do not use the hover state, then I can get the idle and click states working together.

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

    Or should I be doing things in a different way? Thanks in advance!

  • .

    The problem seems to arise because the clicked state does not override the hover state (if you can click the image, your cursor is definitely over the object). So hover state is always active in these 2 states. If I do not use the hover state, then I can get the idle and click states working together.

    It's the other way around. All events are in one big game-loop and if you click your image the state will be immidetly in the next tick overridden by you hover-event. The click-event triggers but you don' see it.

    Put a 'trigger once' to your 'cursor is over'-event. But be careful you have to put it under your 'cursor is over'-event (not a subevent) otherwise you only trigger once the animation setting to 1 not the hover-event.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • MAGICAL! Works now, thanks! I've updated the capx. It's a simple thing but not very obvious if you're new (like me), hope it helps someone.

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

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