Advanced door (but still space for improvement)
A few days ago, we received a new challenge from our admin: make a door. As I went through his tutorial, I got a few ideas, but a special one - doors can be more than just "open/close". So, while running 🏃➡️ (I do run a lot), I come to those lines: - make bigger doors, - implement more than just open/close and - interaction is up to the player. MAKE A BIGGER DOOR Here, I soon came to the idea of using two sprites next to each other. While drawing (still new to Pico-8 and Lua!) I found out I can flip the sprite. So, I delete all "right" sprites 🤣 and keep only the left ones. IMPLEMENT MORE THAN JUST OPEN/CLOSE Okay, I didn't know what else to do, maybe locking, but that wasn't the point of this learning process. I've added a feature to my sliding doors, allowing them to slide up or down. INTERACTION WITH PLAYER (Maybe you already found out that English is not my strongest suit 😀) Later, while coding, I came up with the idea that doors slide down when the player is behind or above them and slide up when the player is in front of/under them. As this platform doesn't allow nice code formatting, I'm attaching a p8 file. Also, that you have sprites. Keep in mind - I'm on 7% of Pixel Art for Game Devs! 🤣 Space for improvement or to-dos - Doors are positioned in the middle of the screen without walls, which constitutes a significant security breach 😉 - You can walk through doors. - Doors should open only when the player is close to them. - ... all above can be easily achieved, as this one does not know how to do ... - The player is positioned on a layer lower than the doors, but when it's in front of them (at the bottom part of the screen), it should be positioned on a layer above the doors. Lua is my new language, so I believe that some lines of code are over-complicated ... but this is (mine) a learning curve 😀