help

  • Hi,

    on my layout, there is 5 objects (same object but with different UID)

    four of them are set invisible, and one is visible.

    What i want is, when i click on the object that is visible it should go invisible and send a signal, and on signal send, it chooses a random number,

    random = 1 it makes object #1 visible, and when u click on that object, wait 4 seconds then it chooses random number again

    Random = 2 it makes object# visible, and so on and so on.

    I tried to do it, but its not working.I mean it does make object that is visible it makes it invisible but it suppose to set timer, like 4 seconds then another object becomes visible but it doesn't do that.

  • Hiya, can we see the events involving the random number and how you're picking a new instance to make invisible? Thanks

  • here

  • The Mouse click trigger only picks the object clicked on, so you can't pick other instances by UID because they have already been filtered out.

    You could add a subevent to Pick All after the wait 4 seconds, and then move the other subevents under that. Or put all that code in a function and after 4 seconds call the function. (They will all be pickable inside the function).

    Just because an instance is invisible does not mean that it can't be clicked on...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • now every time i click on the object it makes all visible at same time lol

  • Remove the pick all, I don't think you need it. Maybe add a 'trigger once while true' condition as well to each of those too if you don't want them moving to layer 0 and setting themselves visible every tick.

  • Pick All is needed because that code is under a "Mouse Clicked on LavaCore" event that picks only the instance clicked on.

    I was about to say I duplicated the code and it worked fine for me (which it does), but then I spotted the problem... random is an instance variable of LavaCore - not a global variable. You need to make a global variable to hold the chosen number to make visible. as an instance variable they all have a copy of the number, and that allows your code to make all visible.

  • It is working now, but it has a tiny problem now.

    when I start my layout, and if i click on the object it does go invisible

    but when it makes it visible again and i try clicking on it, it doesn't go invisible

  • aaah i saw my mistake now xD

    its working perfect now, thank you very much for your help :)

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