So, today marks the first (real) day of development on Flint (the game we currently have no name for).
I've implemented some of the basics of 2d-action/adventure games. Namely, dashing, and double-jumping.
Of the two, double-jumping was definitely the less involved. In the header, I overrode the following builtin functions:
And implemented them in the character like this:
Most of this code is pretty self explanatory. The Jump() and StopJumping() functions are very similar to the base implementations, except we increment our CurrentJumpCount each time Jump() is called.
CanJumpInternal_Implementation() is an interesting function, and I was surprised to find out that, since I started working with UE4, had replaced the simpler implementation CanJump(). Thankfully, the syntax is very simple, and we just add a condition to say "if the character hasn't jumped too much but has jumped some amount, let's let her jump again". This is on top of whatever the super class returns.
The two interesting variables here are MaxJumpCount and MaxJumpTime.
I haven't implemented MaxJumpTime yet, but the plan is to have both double-jumping, and high-jumping for longer button presses (think Hollow Knight). For those of you less familiar with UE4, there are a number of predefined macros which allow us to describe to the engine how the interactive editor itself can interact with variables and functions. So, the declaration of the two of these looks like this:
The UPROPERTY macro allows us to tell the editor how C++ variables can interact with the Blueprint scripting language in UE4. In this case, I've given blueprints read/write access to both variables, to help speed up prototyping and balance testing as we develop the game.
That's it for this post. In the next one, I'll talk about how I implemented dashing, and hopefully have another new feature to discuss.