Physics door

For questions about using Classic.

Post » Sun Feb 19, 2012 2:04 am

Hey chaps.

I am working on a top down game using physics.

I am trying to make a 'Door', and am hoping someone has a good idea on how to control the physics objects.

I have it set up as a hinge sprite and a door sprite currently(hinged), which works well for a free swinging door, but I do not know how to make specific control states, like a close/locked door.

toggling the 'immovable' option breaks hinges.



This is the current set up, the red base is the hinge sprite, the green sprite is the door and the orange sprites are walls. I have created a small orange sprite as a sort of door stop to limit the angle range.


Anyone have any ideas on how to make something like this?Steven2012-02-19 02:21:14
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sun Feb 19, 2012 1:31 pm

Put a Spring on the other side of the door, connected to the wall and increase the spring constant (k) whenever you need the door to "lock".

For checking if the door is locked , you can simply check the value of the constant. A nice side effect is that, at lower values, you'll get an auto-close door.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests