2/18
Be a buddy!!!!
It is highly recommended that a programmer and artist sit next to each other during these lessons. We all come from different backgrounds and experiences... some people are superb with attention to detail. I however was not born with this gift which is the reason I am not that great of a programmer. I am totally okay with that because I have the voice of an angel as a tradeoff. Seriously though... help each other, be a buddy :)
Did you miss a day or is your project not working?
I am going to add the progress file for each day we work in Unreal Engine. it will be located in the SHARED DRIVE > IGD_Share > UEGAME25
This will have all the work and progress we made on this day. You can copy and compare your work to it if something isn't quite right on yours. If you miss a day, you can start where the class left off BUT I would recomment you go back and do the lesson so you can keep your understanding going. This program is unforgiving so you have to keep grinding but you will get it!
Start your day with a warm-up
Watch the video above for BHM
What are you learning?
Weapon System, changing animations, importing meshes.
Why is it important?
This is the start of everything. We are building a game so it is important that you follow along. If you start going on your own and fall behind, it is unfair to stop the class because you chose to do your own thing. If you are confident that you know what you are doing, I have no issues with you moving on your own but you will be held accountable for the project.
How do you show that you understand? What is the assignment?
Follow along and if you fall behind, SAY SOMETHING. You learning is more important than getting to the next step quickly.
We will finish this lesson THEN you are to recreate the game up to this point on your own. Once you have finished, you are to help a buddy in class get their project done untill we are all done. TEAMWORK!
Make sure you have the socket selected
Move and rotate the gun so that it fits nicely in the players hand
We will Stop here for the day and continue in the next session.
Now select Preview Animation and find the Idle Hip Animation
Pause the animation and move the gun until it looks good
Save and close the mannequin
Reset the location and rotation in the details panel for the shotgun
In the the details panel under sockets, select the ShotgunRightHand_Socket for the parent socket
This should place your weapon
Click compile
Now when we play the game, the gun should be set properly
In your details panel under Collision>Collision presets select NoCollision
We don't want the gun to get hit on things as we move around
Compile and save
Time to make the gun shoot
Create a Blueprints folder in your content folder
Open your blueprints folder
Right Click>Add blueprint Class> Actor
Name it BP_Bullet
Open up your bullet blueprint
In components
Click Add>Sphere
Name it Bullet
Grab the bullet component and drop it in the DefaultSceneRoot so that DefaultSceneRoot is gone
The reason that we did this is because the DefaultSceneRoot was the parent to the bullet where the bullet is now the parent
Now add Projectile Movement
With the Projectile Movement Selected in the Components Tab, look over to projectile>initial speed in the details panel
Change the initial speed to 3000 and max speed to 3500
Compile and save
Open up the third person character blueprint event graph
We are going to spawn the bullet
Click the magnifying glass in the add mapping context node
(mapping content is where you point to what inputs should be making something happen)
Click IMC_Default
Open the second mappings and you can see the current inputs in the game (jump, move, look)
Open up the content>>third person>input>actions folder
Right Click
hover over input>Input Action
Name it IA_Shoot (IA for input action)
Go back to your IMC_Default
In your mappings, click +
Select Shoot
Save
We are going to assign the shooting inputs here
Click on the keyboard
Click on none and change it to left mouse button
Save and close the IMC tab
Go back to your ThirdpersonCharacter BP event graph and find jump input
Just below jump input, we will add a new node
Right Click and find Enhanced Actions Events IA_Shoot
So then the action is triggered, we want to spawn actor from a class (the class being the bullet)
Got back to the viewport
Select the shotgun in components
Click Add
Add Arrow
name the arrow Bullet_Spawn_Poss (position)
Move the arrow to the tip of the gun and rotate it to where you want the bullets to shoot
Go back into your event graph
Drag the Bullet_Spawn_Poss into the Event Graph
From the output, pull out and add Get World Transform Node
The get world transform node holds the info for the rotation, location and scale of the arrow (bullet) position
We want to split the Output on the Get World Transform Node output by right clicking on it and selecting Split Struct Pin
Do the same to the input on the spawn transform input on the SpawnActor BP Bullet
Connect location to location
Rotation to rotation
Change the X,Y,Z to 0.2 or the bullet will be massive
Click on Collision Handling Override and select Always Spawn Ignore Collisions
Compile and test
So things are wacky
What is happening is that the bullet is repeat firing
To fix this, we need to move the output in the EnhancedInputAction IA_Shoot from triggered to Started
Compile and test
If you need to adjust your arrow because you are shooting too low or too high, you can also do this in the viewport
If you want to make the bullets faster or slower, open the bullet blueprint, click projectile movement in the components and look for the Projectile speeds in the Details panel
In your event graph select everything we just added
Press C for comment
Name it Shooting System
Go back into the viewport and select CameraBoom
We are going to move the camera over a little bit so we can give the player better view for aiming
Explore the Target Arm Length and the Y Axis Socket Offset then play the game and find a setting you prefer
Our bullets are sticking to the wall
Open the Bullet Blueprint event graph
Right click and add Event Hit
We want the bullet to disappear when it collides with anything so we will pull out and add a destroy actor node
Compile, Save, Test
Alright, we have created a weapon system!
Time to create a new level
Click File > New Level > Basic > Create
Click Add > Shape > Cube
Make your cube then find Materials > Element 0 and click the folder search
In the content drawer, select M_M_Cube_WorldGridMaterial
Click Use Selected Asset
Click the add button
Type Player Start
Select the basic
Move the player start to the top of the cube
Ctrl + Shift + S or File > Save All
Right click and create a new folder
name it levels
Open your levels folder
Name it Level1 or whatever you want to call it
Save
Duplicate the block and move it over so we can create a moving platform to get across
We need to add a new blueprint in the BP folder
Right click > blueprint > blueprint class > actor
Name it BP_Platform
Open up your platform blueprint
In Components
Add Cube
Name it platform and make it a platform
Go to your game and drag the platform in
It is pretty small so change the scale on the X & Y in the details panel to 5
Back in the Platform BP
In components
Add Interp To Movement
In the details panel
Find Control > Control Points
Click the + sign twice to add two points (start and stop)
For the first position, you want the control point to be 0,0,0 position is relative so that where you place the platform is the 0,0,0 position
For the second position, I want to move it along the Y axis because that is where I placed my second cube.
Yours might be on the X axis so check in the game to make sure
Change the second control point on the axis you want the platform to move and test
After testing, the idea number for my game is 700 but the platform moves to quickly
Change the duration in the control of your details panel to a different number
Change the behavior time to ping pong
Test the settings until you have what you are happy with
Add another instance of your cube and platform in the game
Another heavy day... let's stop here and continue next session
Blueprint has a Capsule Collision and a Static Mesh that is a Spike
Adding a respawn
In the Game Mode Blueprint
Righ Click in the Event Gaph and add custom event
Name the custom event Respawn Player
Under Inputs in the details panel, click the +
Name the input Player