0 Favourites

Variable Check

This forum is currently in read-only mode.
  • Hello!

    I am trying to make a fast test here, and I need some help.

    So, I am using the Window object to Hide and Show the game window when I press CTRL+Space.

    To do this, I use a global variable: VISIBLE, wich starts off 1.

    Now, what I would like to do when I press CTRL+SPACE is something like:

    IF (VISIBLE = 1)    Set VISIBLE to 0
                              Hide window
    ELSE                   Set VISIBLE to 1
                              Show window[/code:2lqg7v9x]
    
    Tough, I can't find a way to do that IF. Help? Where is that?
    
    Thanks in advance!
    
    EDIT: After toying around, I came up with another problem: when hidden, the game won't be reciving any key presses. Consequently, it won't get the input CTRL+Space (or any other), and so won't show up!
  • > when hidden, the game won't be reciving any key presses. Consequently, it won't get the

    input CTRL+Space (or any other), and so won't show up!

    Why do you have a game where the game window isn't even showing?? But to answer your question, your game window has to be active to receive key presses. It is a Microsoft Windows thing and you don't have control over that without writing a separate background program that hooks key presses.

  • It is just suposed to be a test... --'

    Thanks for the info. Tough, I see some software (don't know if Construct is able to do this, but oh well) that is in the traybar and with a few keypresses will show up. That's the kind of stuff I want to do.

  • On your "where's my IF at" question

    object.visible --> Do stuff
    |
    else (or you could use: object.invisible) --> Do other stuff[/code:e68e5kqr]
    
    The IF's are hidden, everything is kind of an IF statement so to speak
  • On your "where's my IF at" question

    object.visible --> Do stuff
    |
    else (or you could use: object.invisible) --> Do other stuff[/code:1yzpzpjd]
    
    The IF's are hidden, everything is kind of an IF statement so to speak
    

    You are right with the 'if'-part. All events are structured this way, on the left side is either a condition or a trigger.

    But you are wrong with '(or you could use: object.invisible)' in this case. The reason, why this wouldn't work here, can be read in this thread

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • That explains a problem I'm having right now as a matte of fact. No time to thoroughly read it right now, it's going in my Construct bookmarks

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