How do I Create Open/Close door in 2D Game?

Just started using Construct 2? Post your questions here

Post » Sat May 09, 2015 10:50 pm

Hello guys I have a question that really bothers me... How do you create a door that opens when you click it and closes when you click it again? In 2D game?

I have created 2 Animations when the door is closed and when the door is open but i need the door to be solid when it's closed!

Thank you for any help and attention!
B
8
S
3
Posts: 120
Reputation: 989

Post » Sat May 09, 2015 10:54 pm

give that door an instanve variable "state".
If door clicked and state = 0 then set animation to open and set state = 1
if door clicked and state = 1 then set animation to close and set state = 0
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Sat May 09, 2015 11:36 pm

If you need it to alternate between solid and non-solid behavior, give the object solid behavior - option to start enabled or disabled - and then use the action Solid->Set Enabled (either enable or disable) to change it.
B
13
S
5
G
4
Posts: 139
Reputation: 2,586

Post » Sun May 10, 2015 9:56 am

Thanks for replying! @Fireche & @crypticblonde
I did what you told me @Fireche but it's not working :( is something wrong in the image bellow?

Image

Thanks for your attention!
B
8
S
3
Posts: 120
Reputation: 989

Post » Sun May 10, 2015 10:26 am

@Frap1K .. this works for me: http://prntscr.com/73l9k0
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Sun May 10, 2015 11:06 am

@Fireche ah okey sorry i did it wrong it works now! Now ill have to just add solid to it!
B
8
S
3
Posts: 120
Reputation: 989


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests