Monday, 19 February 2018

Week 21 + 22

Week 20:

HND Project

Been another busy couple of weeks with other Assignments but tor this week and next week, I decided I’ll create a “Sprint” system for my UE4 Project. To do this, I began by opening the “Project Settings” and then I went into the “Input” section, I created a new “Action Mappings” that I named “Sprint” and assigned the “Right Shift” on the keyboard to it. 


I then went into the “FirstPersonCharacter” blueprints and into the “Event Graph”, when I wrote in the following code (See Below). I did this by adding a “InputAction Sprint” box, then dragged the “Movement Component” onto the graph and connected it to a pair of “Set Max Walk Speed” boxes. I then changed the value of the first to “1000” and the second to “500”, and then linked them up to “InputAction Sprint”.


This piece of coding alone allows the Player to suddenly “Sprint” when the “Right Shift” key is pressed down and walk usually when it isn’t being pressed. This piece of coding, however, can be expanded upon and I did so by creating 3 “Float” variables that I named “Current Stamina”, “MaxStamina” and “StaminaRate”.



I then wrote the out the following code in the “Event Graph” in the “FirstPersonCharacter”. Then created a “Stamina Bar” in a separate HUD. To do that I created a new “Widget Blueprint”, opened it and dragged a “Progress Panel” onto the screen and the “Bind” it. I then wrote the following codes in its “Event Graph” and its “Percentage” graph. In effect, this code should increase the Player’s speed while decreasing “Stamina Bar” at the same time.







Monday, 12 February 2018

Week 20

Week 20:

HND Project

Alrighty, I’ve now got the essentials down for an okay game. This week I’m going to be focusing on creating a “Spawn” system to implement into our UE4 Project. To begin with, I had to create a new “Actor” blueprint class and then named it “EnemySpawner”. Once I had done that, I then clicked on it and in the “Viewport” I created a “BoxCollision” I simply named “SpawnVolume”.



Then, I used to the “Spawn Volume” variable to create the following code as seen below. This part of the coding allows the Zombie AI to be spawn randomly and anywhere on the Map. After this, I went into the “GameMode”. There, I created a “EventBeginPlay” and began to create the following code. Basically, this code allows the Zombie AI to be spawn as soon as the Game begins. 




After this, I brought the “EnemySpawner” box onto the Map, before I re-adjusted its length and width to match that of the Map. After that, I pressed play only for… Nothing to happen. This reason for this is because I forgot to set one of the values for the “EnemyPerSecond” variable. Because it was set to “0” that meant no Zombie AI would appear on the screen. I corrected this to the right value I needed (1).

I then tested it again and…

Ta-Da…!!





Monday, 5 February 2018

Week 19

Week 19:

HND Project

After finishing the “Health System” last week, I decided to work on and expand the “Score System” by adding it to the HUD officially. To do this, I went into the HUD and dragged a “Text” box onto the screen. There, I type in “Score:” and then left it as that. I then dragged another “Text” box onto the screen and left it empty. This is what’ll display the score onto the screen.



I then wrote the following piece of coding to accompany it (See above). In effect, this’ll now display the score on the HUD and let the Player know how many points they have accumulated from killing Zombie AI. With that, I could then remove the “Print String” on the “Get Score” code on the “FirstPersonCharacter” graph. 



So… As of this moment, I have more-or-less created the barebones of a game. Obviously, I shall add to more to it because I still have several weeks left and Matt will be creating the levels. But what I’ve done is basically what you must do if you want to create a game at its most basic core. In fact, you could even say this game is Left 4 Dead--  Made by somebody who possesses basic knowledge and only some experience when it comes to using UE4.






I finished up with this week by creating a new “Boorlean” variable called “IsDead”. Using this, I incorporated into several pieces of my code, including; “HealthSystem”, “MovementInput”, and the “MouseInput” codes. Basically, this code will kick in when the Player dies and prevents them from moving afterwards.