Best way to handle unlocking doors
quinn221
Member Posts: 280
In my game I am going to have several locked doors to open. What is the best way to do this...I am thinking tables but not sure how to accomplish it using tables.
Any Ideas?
Comments
use game attributes.
create game attribute boolean name open
give this rule to door
if attribute game.open is true
open this door
else
lock this door.
@Bellow Yes I could use game attributes. But lets say I have 50 doors, won't that mean I will need 50 game attributes?
What are the conditions that allow the door to be opened? This would define the method. You could use either tables or self attributes.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
It's never a good idea to use booleans an otherwise. They are susceptible to looping in those situations.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Tables will work for sure. Just set up a Unlock table. Give the table as many rows as you have doors. Make the row an integer. For every locked door change the attribute to 0. For every unlocked door change the value to 1.
When the table cell value of door 1, (tablecellvalue,1,1) = 0 don't allow user to enter.
When the table cell value of door 2, (tablecellvalue,2,1) = 1 allow the user to enter.
That simple.
@Lost_Oasis_Games The door will open once the Hero collides with the door...as long as he has the key
Okay so so that is easy. Use a self attribute to define which key level can open the door. This way you can make one prototype and just modify the self attribute.
So let's say you have one attribute that will keep the key level. So for each key collected we add +1 since I'm sure this is a progression.
Self attribute in door Key.level
Rule
When hero overlaps and collides
When game.key => self.key.level
Open door.
Otherwise
Timer after
1 second do not check run to completion.
Close door.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@Lost_Oasis_Games thanks again!