UE4 Blueprint: Spiky Block

Note:

This is an old post I made during my Sophomore year of college at Ringling. I’m reposting this again, unedited, because I still find it relevant and helpful. Below, there’s a step-by-step tutorial on how to recreate my cat spiky block with no external assets or fancy programming – however, I feel like the concepts introduced in this tutorial can be applied in many more instances, even in C++ projects like snacko! We use MIDs in snacko to handle our watering system.

We were given a little over a week to make a simple block that can be triggered to move and kill the player. Like the Womps in Mario, our spiky blocks had to have a visual cue before it dropped.

This assignment was done in UE4 with their Blueprint system. The block itself is made from primitives and flat emissive coloured materials. Animations are tweaked in the Timeline, and later called in the Event Graph. In the screenshot above, you can see that they’re separated into:

  • Block Animation: Displacement in the Z-axis for the block to come into contact with the ground
  • Shake Animation: Displacements in the Y-axis to give a visual cue triggered by the player overlapping the Box Collision
  • Camera Shake: Set to shake the camera (screen) when the block reaches the lowest value (ground) to simulate weight
  • Sound FX: Plays a light thud and cat meow when camera shake executes
  • Kill Trigger: Calls the pre-scripted death node to trigger when player overlaps the spike collision box
  • Cheek & Eye Animation: Set in the Timeline with a Color Track to have blush material change to pink and eyes to glow

To change the materials of static meshes or primitives later, you must set it as as the target to the “Create Dynamic Material Instance” node. MIDs must be Set by promoting the node to a local variable to be called in the Event Graph, and the animation timed in the Timeline as a new Color Track.

To simplify the process of “animating” the eyes to go from open to closed, I just had the 4 rectangles serving as the closed eyes behind the sphere that makes the open eyes. Then, applying the same process to animating the block, I added a Vector Track to sphere (open eyes) to move back in the X-axis to reveal the closed eyes when the block makes contact with the ground.

And here you have it! A cute, albeit square, cat spiky block waiting to smash your player into the ground! Using nothing but default assets made available in any new Unreal project, this shows that all you need is some patience to create cute prototypes or simple games easily with the engine.

Leave a Reply

Your email address will not be published. Required fields are marked *