How do I enable/disable objects (Map)

Get help using Construct 2

Post » Mon Jul 17, 2017 7:38 pm

I created a world map that takes up half of the screen.
I'm racking my brain trying to enable and disable on object touch.
I'm not sure how to switch between two variables on the same button.
So, say I touch the main player character, on touching the character I want it to enable and disable the map.
I use to know functions and variables a bit better but its been a while and now I'm just getting frustrated.
Also not sure how to disable things if invisible.
B
7
S
2
Posts: 33
Reputation: 591

Post » Tue Jul 18, 2017 8:11 am

Use a variable as a condition.
On player touched, var = 0, > open map, set var=1
On player touched, var =1 > close map, set var = 0

You might need to put a small wait in though as due to C2's top down structure, it'll set the variable true for both events reading down.

You're right that simply setting the object invisible will not disable it. For a button you'll need to set it disabled. For a sprite you can disable it's collision.
B
47
S
18
G
84
Posts: 2,273
Reputation: 49,800

Post » Tue Jul 18, 2017 9:19 am

@justintime0185

Maybe something like this?

https://www.dropbox.com/s/7t729f0530th2jj/Switch.capx?dl=0
B
41
S
25
G
87
Posts: 310
Reputation: 48,098

Post » Sat Nov 11, 2017 8:29 am

Thanks, folks! Figured it out. :)
B
7
S
2
Posts: 33
Reputation: 591


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests