Invisible entity can still be clicked?

0 favourites
  • 6 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • Hi all

    I was playing around with C2 and noticed that when an entity is set to invisible, it's still possible to interact with it.

    Sample code:

    https://dl.dropbox.com/u/20830426/VisiblityQuirk.capx

    Is this intended behaviour? If an entity is invisible, should I still be able to click it?

    If this is intended behaviour, are there any good alternatives to hiding an entity to avoid a player being able to click it? I figured a quick dirty hack is to set the position to x9999/y9999, but I'm sure there is a better option :)

    Cheers!

  • This is intended - you may have cases where you want to interact with an invisible object. Just check if your object is visible in the click event if you want to avoid interacting with it when it's not.

  • Ah ok, no worries then.

    "Just check if your object is visible in the click event "

    Unfortunately in my case the actions of the menu fire once the menu is hidden :) Basically clicking the menu fires of a number in an Enum (equivalent). I then have (the equivalent of) a case statement saying "if 1 was clicked, do this action". By the time it hits that line though the menu has already been hidden, so the view state can off but the event still needs to fire.

    It would be nice if there was a toggle state to say "Ignore Input" or similar. It would make the events a bit cleaner than having "if visible/not visible' scattered over the place.

    Thanks for the feedback :)

  • use the "wait(x amount of time)" action, followed by your events, to make them happen after the menu was closed. Just make sure to time it right.

  • mmm, I could give that a shot. I usually try and avoid race conditions, but since this is just a prototype it might be fine for now.

    Cheers Fimbul.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For things like menu i used make a global variable called "menu" and do something like this

    +System: menu = "visible"

       + All actions for menu

    +System: menu = "not_visible"

       + All actions for game

    This will make sure that all object for menu are only accessible when global variable = visible - all interactions with buttons, sprite visibility etc...

    It's quite easy and fast to setup.

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