In this workshop, we were provided the "Unreal Engine hour of code" project kit to use to try out function, collisions on objects, checkpoints, blueprints.
To start things off, we added a collision to the "SM_Platform_M_" I selected that platform and added the collision to it. This would come up with green lines. The next part was to duplicate a few platform objects. From here, I did "alt+left click" to drag the object this would give me a new object.
Afterwards, I needed to add in a "pain causing volume" actor for the level. The pain causing volume acts as an actor to respawn the player in the starting area. I did struggle at this part as there were a lack of orange or yellow lines therefore, I wasnt able to tell the scaling for the pain causing volume area.
Due to the unlimited fall on the world, I had to limit the fall inside the level of the game. I enabled "world bounds" to true and scaled the "Kill Z" option of world from "-1143818.0" to "-800".
Once that was done I added a few floating islands in order for the player character to progress further into the game level they had to get to the next island over and in between was the void therefore, I added those floating islands. Once the character reached to the next island I had to add a checkpoint. I had discussed before hand with Jess and saying we'll need a checkpoint at some point during the game and Leigh brought this up after I mentioned that. So, I added a checkpoint after the floating islands and before the moving platforms (the next part of the game development project.)
The "BP_checkpoint" tab I dragged on top to seperate the tabs themselves. Once added, we had a look at the blueprints of the checkpoint to see how things work:
In the blueprints tab, you have three sub tabs: "Viewport", "Consturction Strip" and "Event Graph". The viewport shows the model that is attached to the blueprint. You can change the values of the model for the blueprints themselves.
After looking into the blueprints, we moved onto the next step - moving platforms. First things first, I added a new checkpoint after the first moving platform. For the moving platforms we had to create an animation for the island platforms. To create the animation I went into the 'content browser' tab and went into the following files "Content > Hour of Code > Static_Meshes" and added the "SM_FloatingIsland_". For the two islands I had to go to the following files "Content > Hour of Code > Sequences". I right clicked in the "sequences" folder and created the "level sequence" for the two islands under "animation". Then I renamed the new sequence file to "S_Moving_Platforms". In the "sequencer" window, I set the keyframes for each island.
I selected the two islands and in the grey space area, I right clicked to "Actor To Sequencer" > "Add Current Selection (2 Actors)". In the brief I was following, I needed to loop the animation itself. This is what I did: Step 1: I used keyframe "0015" in its starting position then on keyframe "0045" I moved the islands to a different position where the player character can get to the next island. Step 2: On keyframe "0075" I need to keep the animation still. Because the game is 30 FPS it would last a second. 75 - 45 = 30. Step 3: I copy and pasted keyframe "0015" to "0105". The paste option I needed to select "Transform.Location". Step 4: I dragged the red line from "0105" to "0150". Step 5: Once I added the keyframes, I applied the same first four steps for the other island so it can act as a moving platform.
After the moving platforms, I added power ups and several coins inside the level itself. I scattered the coins all across the islands and for the power up, I placed the "Jump" power up after the checkpoint after the moving platforms. I proceeded to the next activity which was to unlock the door to get the end goal with a key item.
For this activity, I opened up the blueprint class from the "BP_Door_Locked_activity_4_end" asset. In the "event graph" window, I looked at each section of the graph. The "is the door open?" graph I checked the conditions. If player has door key then the statement is "true" if player doesnt have door key then the statement is "false". Which links to the graph "Does the player have a key?" graph. Going into the "BP_Door_Locked" graph when the key is used you press the following key that is shown on the screen. In this case it is 'E'. I right-clicked in the empty blueprint area to get a "Blueprint Class" then in the "Pick Parent Class" window I selected "Actor" which gives me a new actor file and I renamed it to "BP_Key" then I opened up the blueprint. The next step was to add two components, those being: "Sphere (aka Sphere_collision)" and "Static Mesh (aka SM_key)" Inside the event graph, I added a "On Component Begin Overlap (Sphere_coll). Following through the component I added a "Cast To ThirdPersonGameMode" and afterwards, a "Get Plater Pawn" node then a "Set Have Key?" right after which links from the Third Person Game Mode arrow to Target. I setted up an executable action to play sound when the key is picked up this is called "Play Sound 2D". The reason this node had to be used is that when a playter picks an item a sound will be played. This makes perfect sense in video game logic as this will make the player certain they have gained that item through sound. Inside the "Play Sound 2D" node, I had to target the sound asset in to "SFX_Key" afterward, I set up a "DestroyActor" node. Going back into play node, I placed the "SFX_Key" right outside the locked door. Then to get to the door you have to press 'E' (assuming you have the key with you.). Inisde the building, I added a "BP_endGoal". Once the player reaches the end goal of the level, this will show a ending screen that says: "Congratulations!" with a time taken + coins obtained + gems obtained.
Overall, the hour of code game kit proved to be quite useful and was worth learning through the blueprints and assets in Unreal Engine. I look forward to learning more and using the UE game engine software the more I use it.
Comments