top of page
  • Cade-Mason

Unreal Engine exercise: Door and Key assets and functions

As part of our weekly Unreal Engine exercises, this exercise is the door and key assets and functions which are vital to a puzzle game. The first thing I did was open up the project in Unreal Engine. From there I went into the ThirdPersonCharacter blueprint and made new variables and functions in the event graph. The variables I created were: Health and Energy (Float) (Default Values at 1) and MaxAmmo and Ammo (Integer) (Default Values at 25)



I created blueprint classes (Actor) for door and key (although Key was created later on). For the "LockedDoorBP" blueprint file, I added an 2 events called "Component Begin/End Overlap" for the box colliders both. Inside the components, I dragged out the execution pin for "Other Actor" to create an opponent for "Cast To ThirdPersonCharacter". Afterward I created a function for "Get Player Character". Following on from begin overlap I used the Enable Input. The same applied for End Overlap but this would be for Disable Input. The next step was adding a branch with set target for keys (which links to ThirdPersonCharacter) and the gate function comes after Branch under the "True" execution pin. After Gate I created a "Flip Flop" function and under the 'A' execution pin came the Timeline function.


For Door animations I had to create an open and close door animation inside the blueprint files through the viewport window. For "Open Angle" I rotated the door at -90 or -100 degrees and changed the default value. The closed angle remained untouched. And that is how the animation for a door is created in Unreal Engine. Definitely is a viable and essential asset to use for when we do create our game. Back in the event graph I got the closed and open angle variables. For closed angle I put the execution pin in 'A' and the open angle pin to 'B' in the lerp function. That next thing I did was to get a 'static mesh' function and dragged out the pin to 'Set Relative Scale 3D' then I split the structure pin which gives new rotation components I hooked up the lerp execution pin's return value to 'New Rotation Z (Yaw)'


Once that was done I went back to the play window and tested out the new door. A key is required to open the door. You would get a sound effect for a locked door and an unlocked door the sounds are different for each one as it holds a significance in sound design.

I went back into the "KeyBP" blueprint file inside the viewport window I needed the player to know when they picked up the key I did this by adding sound to the key and creating a boundary to where the player can get a hold of the key. I changed the dimension of the cuboid shape. I copied the "LockedDoorBP" blueprint's event graphs functions over to the KeyBP's event graph. From the InputAction Interact function I grabbed the 'Pressed' execution pin to link to the 'Gate' function inside the 'Drive' component. Then for the 'Cast To ThirdPersonCharacter' function inside of the components I used the "As ThirdPersonCharacter" component pin to drag to the 'Set Has Key' function.


I dropped the key into the console play window and placed the key where I needed it to be - next to the door area. I would also go ahead and changed the bounds scale to a smaller size as I found that the boundary was too big and wanted the player to approach next to the key. It felt appropriate this way. From there I tested the player to pick up the key and to use that key to open the door. It worked and there door animations working.

Overall having a door and key asset would be vital to our puzzle platformer idea of the game and this can work with the game me and my team have in mind.

4 views0 comments

Recent Posts

See All

Unit 44 Advanced Game Development Studies introduction

On the first day, I arrived back at Nescot college, I got assigned to "Unit 44 Advanced Game Development Studies" Originally, the game is about creating a working indie game as a class (3 people). How

Marketing methods and monetization in video games

For a video game - marketing and monetization are vital in game development. If you need to earn money for your game, monetization and financial methods are the way to go. How I would approach marketi

Post: Blog2_Post

07813 596621

  • Facebook
  • Twitter
  • LinkedIn

©2020 by Cade's Creative HND Portfolio. Proudly created with Wix.com

bottom of page