Devlog 2


What has been updated: Added destroyable and respawning enemies, randomized key colors, moving platforms and falling platforms, and two usable items.

First, randomized key colors. I randomized my key colors by using an enum for material colors.I set up an enumerator with Materials 1-5. Then in the key blueprint, on begin play we get a random number between 1 and 5 to make a selection. Then each selection corresponds to a set material.

After this I set up items. To set up items I made an interfaceThen in the 3rd person controller I set up an event for trying to pick up an itemWhat this does is, it gets the most recently touched item and sets it to held, as long if the player isn't already holding an item. Then it goes to use pickup from the BPI. After this is setup we go into the health potions blueprints. Here, when the third person controller overlaps with the pickup trigger on the item, it will do the Try to pick up event from the character controller. Then it uses the event pickup from the BPI and attaches the item to hand of the third person controller while disabling its own collision so that it doesn't collide while its in the hand of the player. After that I made the event for dropping the item.Here, it detaches the item from the 3rd person controllers hand. Then it enables physics, collisions, and gravity for 2 seconds before destroying the item. After this is the primary use for the item.

What happens here is it prints out plus 10 health, then destroys the item. To call on these events we have the some keybinds set up in the player controller.Here, if Q is pressed, it checks if an item is being held. If it is then it does the drop event. If not it tells the player that they are not holding anything. If E is pressed it does the same thing but instead of the drop event its the primary action. After doing the items was the platforms.For the falling platforms, when there is overlap between the character and the platforms collision then the activate event is started. The next section gets quite a bit messier, because I dont have a mouse.First is activate. We have a Boolean called is activated set to false. In the Activate event there is a branch to see if the condition is false. If it is it tells the player they have one second left, then sets IsActivated to true, changes the material of the platform, then goes to the drop event. In the drop event, it checks if IsActivated is true. If it is, it tells the player that its dropping. To drop it turns on physics for the platform. Then it after it finishes dropping (after the delay finishes) it changes the material back to normal then goes to reset. In the reset event, it prints "Resetting!". Then it sets a variable called reset transform to the current platforms position. Then it turns physics for the platform off and then goes into a timeline. The timeline has one keyframe at 0,0 and another at 3,1. We have the track from the timeline go into the alpha of the Lerp Transform. In the lerp transform we plug in the two variables Reset Transform and Starting transform. We set starting transform at the start. So these plug into the lerp transform, then the positions from the lerp transform are plugged into the Set World Location and Rotation for the falling platform. So basically Lerp transform slides from the two variable transforms based on the keyframes in the timeline track, plugging that sliding value into the location and rotation for the platform. Making the platform smoothly reset over three seconds. Once the timeline is finished it will update IsActivated to false, so that the platform can fall again once its reset. After that is enemies. 

  For enemies, theres three things. The basic enemy, the enemy spawner, and the enemy spawn manager. For the basic enemy, 

When the collision capsule for the enemy overlaps with the player, it will turn on physics, then call on check enemy count, before destroying the enemy

For the enemy spawn manager. When the game starts, it will tell the player that the manager is ready. Then it will get all the Enemy spawners that are in the scene and set that to an array called Spawners. Then it will do the Spawn Enemies event.

The spawn enemies event uses a for each loop that will loop for every enemy spawner there is by using the Spawners array. In the loop, it spawns an enemy at each enemy spawner, by getting the world transformation of the spawner its at in the array, and setting that location to the spawn actor. The spawn actor, simply spawns in an enemy every loop and adds 1 to the current enemy total.

Then we have the check enemy count event which is used to respawn enemies when there are none left. First it subtracts one from the Current enemy total, since this event is called whenever an enemy is destroyed. Then it checks if the current enemy total is less than 0. If it is, then after a delay it will tell the player that a new wave is incoming before doing the Spawn Enemies event.

Files

MyProject2.zip 478 MB
4 days ago

Get MyProject

Leave a comment

Log in with itch.io to leave a comment.