Dev #3 – The Divine Drive

Hey everyone.

I hope you’re having a great day.

It’s been a little bit since my last post. I decided to slow down on the number of posts because if I were to post every day, there would be many times where I wouldn’t have anything to say.

Today we’re talking about the Divine Drive – your main source of power. When you entered Isevr’s Complex, it was severed from Orilfen, and your power was limited.

Whenever you use a spell, you use some Divine Energy. Maybe I’ll call it Ether; not quite sure yet. E(i)ther way, your spells cost DE to use. Your Divine Drive can only hold so much of it at one time.

Since you are severed from your goddess, it will also make some of the Divine Drive “break.” This is just represented as part of the capacity becoming unusuable.

The Divine Drive is represented as a circle gauge with three colored sections. The white portion is the amount of available Divine Energy. The light gray portion is the amount of unavailable energy. This can be recharged by killing enemies. The dark gray portion is broken capacity, which cannot be reused. Finally, if the entire drive is broken, it will be shown as a black circle.

If the drive is completely full to its broken portion, it will have a glowing effect show. Here’s the spritesheet for the Divine Drive right now.

And here’s an animation of me playing with the debug controls.

There are two miscellaneous symbols in the spritesheet – an X and a /. I plan to flash these over the Divine Drive display when you try to cast a spell that you don’t have enough power ( / ) or capacity ( X ) for. Maybe I could also make the available portion flash red using some bitmap manipulation, although InsanityEngine does not currently have a method to tint a bitmap.

Come to think of it, I could just load the bitmap and set the Green and Blue channels to 0, and store that as an alternative bitmap to read from. Ultimately, that would use a lot more memory. Currently, the Divine Drive bitmap uses 204.8kB of memory.

There’s something I need to confess. Usually, when I write these articles, I realize that I should implement something into the engine and then do so, during the course of the article. It’s actually been a few days since I wrote the previous section (because I keep losing the drafts), and I’ve implemented image tinting.

Now, when the Divine Drive has less than or equal to 4 segments left (just as a temporary test), the Divine Drive will tint to (.6, 0, 0, 1), which is a middle red.

The intention is to make this animation flash later on, but for now this is fine.

Now, let’s implement the view of how much juice you have left. We’ll just leave it centered above the circle view.

Now we have the amount of remaining and unbroken power left, but there’s a few issues.

  1. The text is difficult to read since it’s so close together
  2. The circle does not reflect the actual state of the text.

The first issue is an easy fix. We can just add some spaces to our format string, “%i/%i”. For the second issue, it’s a similarly easy fix. On each game update, we’ll copy the values of the Divine Drive into our Divine Drive Gizmo class. Here’s the new code for that:

		int powerLeft = game->player.dDrive.getRemainingPower();
		int powerMax  = game->player.dDrive.getUndestroyedPortion();

		int powerLeftSections = powerLeft / 12.5;
		int powerLeftMax      = powerMax / 12.5;

		exhaustedportion      = 8 - powerLeftMax;
		remainingportion      = powerLeftSections;

		LIMIT(exhaustedportion, 0, 8);
		LIMIT(remainingportion, 0, 8);

Now, we get the power from the Divine Drive itself, which now controls directly how the circle is rendered. I’ve also modified the debug keys to modify the Divine Drive’s power itself.

		#if _DEBUG
		if (game->input->KeyNewlyDown(KEYBIND_DEBUG_BUILDER_LEFT)) {
			game->player.dDrive.spendPower(10);
			game->player.dDrive.destroyPower(5);
		}
		if (game->input->KeyNewlyDown(KEYBIND_DEBUG_BUILDER_RIGHT)) {
			game->player.dDrive.restorePower(10);

		}
		if (game->input->KeyNewlyDown(KEYBIND_DEBUG_MENU_5)) {

		}
		if (game->input->KeyNewlyDown(KEYBIND_DEBUG_MENU_6)) {
			game->player.dDrive.reconstructPower(10);
		}
		#endif 
		

Here’s how it looks now.

As an added bonus, I found out why I keep losing the drafts. Apparently I can’t use emoji at all or else it fails to write it to the database. Nice.

Back on track, I think I’d like to make more entries in the sprite sheet to get more variations I can use for the wheel. Or maybe I could do something like a conical gradient and filter it. Not sure. I’m leaving that for next time because it’s late and I am tired of looking at glorified pie charts.

Next time – well, I have no idea. Maybe something more about the Divine Drive, or implementing attacking. Come join me on my Discord!


Comments

Leave a Reply

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