Object inheritance and states
Continuing with the options to open doors and solve puzzles there's always an easy interactions to user that is transporting something fragile and place it in the right place to activate something.
As always I first test the interactions without the animations and with simple code .
After I get it to work with the rest of the objects and in the object-oriented system, I move to draw all animations and to code the hard parts of all the possible states of the object until I get to the final result.
So, all of the "interactable" objects are children of a light object that has the basic code and all of the possible states.
After that each child has a different code in some of the states and doesn't have to have all of the states.
For instance the small light piece is a child of the main light object and it doesn't need any state, but it needs to interact with player.
and the light stand has a bunch of them for all of the animation states
I hope you learn something and please comment if you have any questions.
Next: big doors that only open with 2 light columns :)
Leave a comment
Log in with itch.io to leave a comment.