3/5
Start your day with a warm-up
Summarize and share your thoughts.
HALF PAGE!
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 build the game.
Grab this animation and copy it to your desktop
Let's create a box in blueprints.
Right click > Blueprint Class > Actor
Name it BP_Box
Open it
In your BP_Cube Blueprint
Add a cube in y9our componenmts
Find Physics in the details panel
Select physics
Click Simulate Physics
Click mass
Chance the mass to 35kg (so you can actually move it)
Go to your game map and stack some boxes near your pressure plate so you can knock them down and make the door open
Compile, save and test
Make sure the box can open the door
Light Switch
Right click > Blueprint Class > Actor
Name it BP_Lights
Open it
In components, add a cube (we will make a little platform)
Add lights
Add > Point Light (We want this to be a child of the cube this time)
Change the color and increase the intensity
Add a second point light and make it a different color
Make sure it is a child of the cube and not the first point light
Add a box collision to your cube and make it fit the cube
Open your event graph
From Event Begin Play, oull out Set Visibility (Point Light)
Click new visibility on (make it true.... booleans baby!)
Pull out a delay from set visibility
Make it 1 second
From our delay, pull out another set visibility (make sure it is on the same point light you used)
This time do not check the new visibility box so it is false
Add another delay
Now we are going to make a look so it keeps goingÂ
From the output of our delay, pull out the node and connect it to the input of the original set visibility
If you want to pull out and make the node wider so it is easier to see, just double click it then pull it out
Compile Save Drag your Light Box in the game map and test
Next go back to the event graph and break the lnode from event begin play to set visibility
From Event Begin Play, add a Flip Flop
Flip Flip will alternate the actions A & B
Connect Flip Flop A to Set Visibility
Now we are going to duplicate the nodes we created for our first light by copy and pasting then change the name to our second light
Notice that once it finishes, it loops back to Set Visibility and not Flip Flop. We need to break the link and connect them to Flip Flop to complete the loop properly
To do this, right click on the Set visibility input and hover to Break Link to Reroute Node
You will also need to do this for the final delay on order to connect it to the flip flop node.
Compile, save and test
Connect the outputs of the delays to the input of the flip flop
Compile, Save and test
Time to make a health bar
Open your content folder and add a new folder called UI then open it
Right Click
Select User Interface > Widget Blueprint
Select User Widget
Name it WB_HealthBar for Widget Blueprint and open it
In the WB_Healthbar
Search for Canval Panel in the palette
Drag it into the Healthbar Hierarchy
In palette, search for Progress Bar and add it to the workspace in the top left corner
Change the color to red or whatever you wish
You can preview the color by adding a number to the Percent in the progress in details
We are going to place the anchors by clicking on the flower/pinwheel type thing
We do this so the bar stays put no matter what the screen scale is set to
In the progress, add 100 opercent and click bind
This will create a widget that will send/receive info
From the Get percent, pull out asnd add Cast to BP_ThirdpersonCharacter
From the Object add Get Player Character Node
From the As BP Third Person Character output, add Get Health Variable
From the health pin, we needf to add a divide because we need the health hits to be proken up sp that it takes off a portion of the progress bar depending on the number left in the variable.
You need to make sure the number you gave for health in the BP_ThirdPersonCharacter is the number you are dividing by
Connect the green output of the divide into the return value
Compile, save
Open your BP Third Person
Find the Add Input Mapping at the top of the Event Graph
Pull out a Create Widget Node from Add Mapping Context
The Class will be WB_healthbar
From the Owning Player input, pull out and add Get Player Controller
From the create heathbar widget output add a add to viewport node AND connect the return value to target
Compile, save, test