problem

0 favourites
  • Hi,

    if i click on icon, it opens window. Window is now visible and showing but if i click the icon again it opens same window again, now there is two windows.. I want to know how can I make it only show one?

    Like, if u click icon it opens window, if click icon again it wont open window because it is already opened. I tried the "Trigger Once" but that ain't helping.

  • Lol i see my problem now, i put the Trigger once while true at wrong place.

  • I put

    on left click icon

    under it is Trigger once while true > set object visible

    that works perfect, it opens it once.

    But for some reason when its

    on left click icon

    under it is trigger once while true > System - create object on layer 0

    that doesn't work, it keeps opening more and more windows.

  • Are you referring to the chrome window or some object in construct that is acting as a window?

  • some object in construct that is acting as a window.

  • Okay putting it in a while loop is going to cause it to keep happening in javascript and many other languages .

    The while function is a looping function that keeps repeating the code within the body of the function until the condition is false it's the same in construct presumably :

    int x = 1 while(x >= 0) { //render stuff }

    So you want to replace that with something else that can be consistent like a tick or second delay,etc

    tick can be found in system I think.

  • if i put the window object invisible

    and if click on icon

    under it Trigger once while true > set window object visible

    That works perfect, but if window object is invisible and when i start layout and click every where on screen it opens the window. So object is there.

    so this is why i set it to create object

    but now the trigger once isn't working.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to put these window states into variables :

    Boolean Window On Screen - YES/NO

    Boolean Window Open - YES/NO

    Boolean Window Close - YES/NO

    Then like when you click on the instigator it will set one of those booleans to true or false

    then you can put the window after doing a condition statement on the screen then turn it off when needed,etc

    This will create a light switch-like window showing system hopefully.

    Boolean is a technical term for a binary digit switch it works like this

    True = some binary number

    False = some binary number

    Then in binary wrap those 2 binary numbers into a token like true or false also using binary :)

  • uh idk if i did it right lol

  • You need to set open to false after the left button is clicked and the system condition has executed properly

    also I'm not sure that trigger once will help you here because it might only let you do it once, see if their is something else that can make you just do it because the false should handle stopping it happening again until you clicked again another time.

    Unless I'm dumb.

  • Yeah I set the open to false after the left button is clicked.

    but it still opens more than one window

  • just found a solution :)

    i removed "on start of layout > destroy window object"

    I moved the window outside of the layout.

    When click icon, that icon spawns another object which is the window object. Then i just set the window object to the position i want xD

    and under click icon i put "Trigger once while true"

    so it is now working perfectly, cant believe i haven't thought of this lol

    But Thanks a lot for your help :)

  • lol ok, the spawn object did not work, still kept opening more windows.

    so I removed that, put my object on layer 0, moved it out of the layout.

    when click icon, it opens window, i set it at the right position XD it working now.

  • and now another problem happened.

    spr_invSlot frame 0 and 27 doesn't pin to my window object.

    they don't show when i click the icon.

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