Skip to content

Narwhal Simulator 16: Adding Health

Hi everyone! Today’s post will be a bit short because I didn’t do much this week. Let’s get right into it.

This week, I made the player have health. The health doesn’t serve any purpose at the moment, since there is nothing to damage the player. It’s preparation for making creatures, which is coming up shortly! Here’s the new health bar:

As usual, I’ve been careful to make sure it works well and looks good on a variety of aspect ratios and resolutions. If you’re following along on your own computer, you’ll notice that there’s no current way to take damage. In the player’s Update method, uncomment the following line to take damage over time:

Damage(0.01f, Vector2.zero);

The Damage function is used to damage the player, as well as update the UI. The first input is the amount of damage and the second is the location. I’m planning on using the location to allow the player’s particle system to emit particles at the right location, or maybe damage different parts individually. It doesn’t matter at the moment so you can set it to whatever you want.

Next week’s plans are not very interesting either, unfortunately. I need to make a way for tiles to either have scripts attached to them or have custom data attached to them that I can manipulate with a script. This will be for spawners.

Also, I added bedrock. Bedrock is a very hard block which doesn’t give you much score when you break it. I’m planning on having it replace regular stone in the harder areas. I know that adding new blocks isn’t something I should be spending my time on at the moment, but the sprite was already in the project so I figured I might as well add it. Here it is:

That’s all I have for you today. I’ll be working on adding scripts to tiles for the next week. Hopefully, I’ll have some interesting results for you by then. Then, we can finally start adding some creatures! That should be fun, and I think it’s about time to add some life to this otherwise dead world. It’s getting a bit lonely. If you have any fun and interesting creature ideas, be sure to leave them in the comments! See you next week.

Links recap:

GitHub: https://github.com/AgentD1/NarwhalSimulator

Trello: https://trello.com/b/Nd7rNvWU/narwhal-simulator

1 thought on “Narwhal Simulator 16: Adding Health”

Leave a Reply