Making the Game: Adding Style
As promised in the last post, this post will focus on how I created a more stylish effect when a cube key comes in contact with a cube-activated button, as well as some extra style-related things.
To begin, I created a Custom Event in my Cube Key blueprint called "Snap Into Place", which will be called when the key and button make contact. To prevent the player from interfering with the key after it comes within the button's trigger box, I turned off physics simulation on its static mesh using the Set Simulate Physics node. Since the invisible shockwave projectile can only push objects that simulate physics, this makes the Cube Key immune to its effects!
The next step was to get the key where it needs to be. To do this, I used a Timeline to Lerp between its rotation and location at point of contact to the "target location" and the default rotation of (0, 0, 0). "Target location" is an instance editable variable, which is set from the button itself.
In my previous Cube Button blueprint, I set the "target location" on its attached key before checking for the validity of the door variable. "Target location" is the world location of the button's static mesh combined with an "offset" (the value of which I found by testing). Then the key's new "Snap Into Place" event is called and after validating that there is a door attached to the button, there is a 1.5 second delay by use of the Delay node (kind of like returning a WaitForSeconds in an IEnumerator in Unity) before the door itself opens. This is so that the animation of the key snapping into place can run its course.
To show that the button was indeed activated, I decided to swap the cube and button's material using the Set Material node - the cube goes from glowing to dark and vice versa. This happens just as the door begins opening.
That was the cube key done, but before I show it off, there were other things I did as well...
However, there are no restrictions on introducing outside content into this project, which is why I decided to import the font into it!
Now, importing a font for use in UI and HUD elements is fairly straightforward, as the font is simply imported with a cache type of "Runtime". If one wishes to use a font in a text renderer, things are not as simple.
Strangely there seems to be no official documentation on how to import fonts for use in text renderers. Luckily I found an illuminating tutorial to follow, so it was not an issue in the end. Speaking of illumination...
Cube Key Snapping
I wanted the cube to snap into the button with an interesting animation and the materials on the cube and button to change. I am fairly satisfied with the result I achieved, I must say.To begin, I created a Custom Event in my Cube Key blueprint called "Snap Into Place", which will be called when the key and button make contact. To prevent the player from interfering with the key after it comes within the button's trigger box, I turned off physics simulation on its static mesh using the Set Simulate Physics node. Since the invisible shockwave projectile can only push objects that simulate physics, this makes the Cube Key immune to its effects!
The next step was to get the key where it needs to be. To do this, I used a Timeline to Lerp between its rotation and location at point of contact to the "target location" and the default rotation of (0, 0, 0). "Target location" is an instance editable variable, which is set from the button itself.
In my previous Cube Button blueprint, I set the "target location" on its attached key before checking for the validity of the door variable. "Target location" is the world location of the button's static mesh combined with an "offset" (the value of which I found by testing). Then the key's new "Snap Into Place" event is called and after validating that there is a door attached to the button, there is a 1.5 second delay by use of the Delay node (kind of like returning a WaitForSeconds in an IEnumerator in Unity) before the door itself opens. This is so that the animation of the key snapping into place can run its course.
To show that the button was indeed activated, I decided to swap the cube and button's material using the Set Material node - the cube goes from glowing to dark and vice versa. This happens just as the door begins opening.
That was the cube key done, but before I show it off, there were other things I did as well...
A New F(r)ont(ier)
For the previous installment of Robotrooper, I used a font called "Elektora" in its manual and accompanying materials. I could not use it in-game, however, due to assignment restrictions.However, there are no restrictions on introducing outside content into this project, which is why I decided to import the font into it!
Now, importing a font for use in UI and HUD elements is fairly straightforward, as the font is simply imported with a cache type of "Runtime". If one wishes to use a font in a text renderer, things are not as simple.
Strangely there seems to be no official documentation on how to import fonts for use in text renderers. Luckily I found an illuminating tutorial to follow, so it was not an issue in the end. Speaking of illumination...
Let There Be Lights
To liven up the environment a little, I decided to add some lights in to the rooms. So, using the good old brush tools, I whipped a model up.
Then it was time to create a material that emits light. After inspecting the "M_Tech_Hex_Tile_Pulse" material that comes with Starter Content, it was not too hard to figure out how to create a much simpler version that does what I want.
And this is the final result! Originally I had envisioned the lamp as being in the corner, but joining two of them together seems to create a more appealing shape, at least in my opinion.
As you may have noticed, I also created a Wide Door Blueprint which features in two of the previous pictures. This is, in principle, identical to the cube-activated door, except it is instead activated by its very own trigger boxes! Oh, and it closes after opening, too!
Another thing I added was a "skybox" which I made out of some Starter Content walls. This is to go with the whole "Simulation" theme of the game. I added some "floating bits" outside the playing area as well.
That's it for Week 5. Until next time.
Honorable Mentions
As you may have noticed, I also created a Wide Door Blueprint which features in two of the previous pictures. This is, in principle, identical to the cube-activated door, except it is instead activated by its very own trigger boxes! Oh, and it closes after opening, too!
Another thing I added was a "skybox" which I made out of some Starter Content walls. This is to go with the whole "Simulation" theme of the game. I added some "floating bits" outside the playing area as well.
That's it for Week 5. Until next time.
EDIT: Oh, I forgot! Here's the footage of the Cube Key snapping into the Cube Button slot.










Comments
Post a Comment