Page 1 of 1

How to not display a box if player width is <=950

Posted: Thu Mar 07, 2019 9:58 pm
by SergePix
Hello,

i was trying to find the right way that would not show the map if the screen is smaller than 950 but have the option to display it if needed.

I already have a button that toggle the map with a map_show_hide (true/false) variable.

On the map, I created a logic box:
Visible = enable
Variables: map_show_hide = false; visible = false

But the map_show_hide variable is at true by default.

How to set the map_show_hide variable to false if the screen is <= 950.

Re: How to not display a box if player width is <=950

Posted: Fri Mar 08, 2019 12:44 pm
by Hopki
Hi,
Please find project attached.
How it works...
The skin as a variable: vis_map, true/false, true.

The Map/text box has its visible check box deselected but has a visible logic block: *vis_map = true, Visible: true.
The map will show on project open because the variable is set to true.

The Toggle button has the action: mouse click, set variable value, vis_map, Not(¬)
This action toggles the variable between true and false thus hiding and showing the map.

It also has the action: start, set variable value, vis_map, Set(=), false.
Now this would on project open set the variable to false so the map will not show.
But of course we only want this to happen if the player is 950px or below.

To do this there is an action filter that states: Player Width, <=, 960.
So this action only gets executed if the player window is 950px or below.

Please see: Logic Blocks and Action Filters.


Regards,
Hopki

Re: How to not display a box if player width is <=950

Posted: Fri Mar 08, 2019 3:24 pm
by SergePix
Hello Hopki,

it works perfectly! :D

Thanks for your help!