Variable Check

For questions about using Classic.

Post » Thu Apr 14, 2011 10:23 pm

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:

[code:2lqg7v9x]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!
B
4
S
1
G
2
Posts: 75
Reputation: 1,000

Post » Fri Apr 15, 2011 12:08 am

>> 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.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Fri Apr 15, 2011 12:26 am

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.
B
4
S
1
G
2
Posts: 75
Reputation: 1,000

Post » Fri Apr 15, 2011 2:17 am

On your "where's my IF at" question :P


[code:e68e5kqr]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
B
6
S
3
G
1
Posts: 76
Reputation: 1,002

Post » Fri Apr 15, 2011 8:39 am

[quote="Kouji San":1yzpzpjd]On your "where's my IF at" question :P


[code:1yzpzpjd]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[/quote:1yzpzpjd]
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
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Apr 15, 2011 11:35 am

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 :P
B
6
S
3
G
1
Posts: 76
Reputation: 1,002


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests