Day 7 Senior Project

Work Day 7

    May 16, 2023- Welcome yet again to my fabulous, mystical, maniacal blog dear readers! Today I have yet again continued the creation of my video game. Today I began the process of learning how to create and implement interactable items and NPCs. To do this I utilized this handy coding thing called inheritance which allows you to create classes built upon existing classes, so I don't have to write out a ton of code for every different interactable item and NPC, I simply call generalized methods and use them in a class specified to the specific item or NPC.

Below are some segments of code.

This class is the base code for collidable objects, so anything the player interacts with by running into. Any sprite with this piece of code as a component is able to be interacted with. It basically continuously checks if there is something to interact with and if there is it logs the thing's name in the console as a placeholder.



    This segment here is assigned to any items that are collectible, aka any item that changes when interacted with. It basically is just checking if the object is collectible, if it is it sets collected to true as a placeholder for whatever may actually happen to a specific item.



    This class is for a specific item, chests. Though I don't intend to utilize currency in the game, I used this to practice creating such an item. What the code basically does is if OnCollect is called when the last Collectable class runs, it switches the texture and sends a message in the console that the player has been given 'x' coins.




    This class is for the portal connecting the start area to the general world. It loads a designated scene upon collision.


Hours Today: 4 hours 20 minutes

Hours Total: 26 hours 10 minutes

Comments

Popular posts from this blog

Day Two Senior Project

Day 12 Senior Project

First Day of Senior Project (Creating a Video Game)