Enemies, Potions, & Platforms


For the past two weeks, we have continued to work on this project! 

A week ago, we modified our existing keys so that they can now change color! This involved creating multiple arrays, specifically ones for our keys and the colors we would like to change them to, and loops, specifically ones that would continue to change the color of the keys. We shuffled both the keys and colors in order to make the new colors randomized. We then set the value of the base color of the randomly chosen key to the randomly chosen color. We ensured that the keys could continue to reshuffle once a key had been taken by the player by creating a branch an or loop that called upon the length of the array. 

We also created enemies in this game! This involved creating an enemy, an enemy spawner, and an enemy spawn manager. We placed the spawns throughout our level, making sure they were set to be invisible when the game was played. Then we used a for each loop to spawn the enemies, making sure they were in the right location and facing the right direction by specifying the transform properties would match that of the spawner. We then allowed these enemies to be defeated by adding an event that would occur when the player overlaps with the enemy’s collision. At this time, physics would be enabled, allowing the player to push the enemy around before it finally despawned. Once each enemy was defeated, a counter would be updated in the manager of how many enemies were left. Once all were defeated, and after a short delay, a new wave would be spawned in, looping the whole thing all over again. This involved utilizing an event from the spawn manager, the enemy counter, in the enemy script in order to properly track how many enemies were left and whether or not more needed to spawn. 

This past week, we started by working with interfaces to create basic functions for items in our game. This included Picking Up, Dropping, and using the item. In order to pick up the item, we created a function in our Character to Hold Items. This would be called when the player overlapped with the item, given they were not already holding something. To drop it, the item detached from the hand of the player and gained physics/collision. To use the item, the player would press a button that caused the item in their hand to disappear and gain +10 to a certain attribute(although this attribute doesn’t really do anything besides saying it exists).

We also worked with adding platforms to our game! In order to make a moving platform, we added two static meshes to the platform called “Start” and “End.” Start would be at 0,0,0, and End would be higher up. We used Timelines to make the platform move from the Start to End locations smoothly. We also added falling platforms! To do this we did something very similar to the Moving Platforms, but instead set the platform to have physics upon being activated so it would fall to the floor. We created functions for the platform to Activate, Fall, and Reset. Additionally, we set the platform to change colors as it Activates, Falls, and Resets. 

Overall, quite a bit of useful information was added to the game!!

Files

Coding1_WinUpdate1.zip 760 MB
Jul 19, 2024

Get Coding 1

Leave a comment

Log in with itch.io to leave a comment.