Laser Doors


The laser doors are now working:

This turned out to be fairly simple.  I created a simple set of tiles that animate the door from fully closed to fully open (with a transparent background so we should be able to use these on grass too!).  Using some of Unity's 2D collision components on either side of the door, a very simple script looks for a collision with the player (or some other entity with a collider - I am hopeful in the future that NPCs can use doors).  When there is a collision the door starts animating down to the fully open frame, switching out each tile one after another until it gets to the last frame (i.e. the open door tile) where it also disables another collider that allows the player to walk through.  If at any point the collision stops (i.e. the player walks away) and the script just reverses the animation and re-enables the collider to prevent the player getting through a closed or partially-closed door.

I probably could have used Unity's animation tools to do the same thing but this just felt so simple and easy to understand that I felt more comfortable spending literally 5 minutes coding this instead of trawling through hours of Unity videos to learn how to use the animation tools.

Feels good to start to see the world just starting to become interactive!

Next I want to flesh out some more of the map and start to think about some of the more interactive parts of the game - e.g. in the police station right at the start and the store (the room just above the one in the screenshot above) there is some very basic "dialog" that holds the player until the dialog completes.  I also want to start thinking about how to make the NPCs walk around.

Get Mechfight Remake

Leave a comment

Log in with itch.io to leave a comment.