Loading...
15
Game
Hensen Hopper
12 days ago

I don't know how well you can see it in this video, but I've coded a dashing mechanic for Hensen Hopper! I plan to have dashing consume a "dash charge," a kind of ammo you can get as you play in the form of enemy drops.


The way I've written this actually makes use of the sine function! Whenever the player presses shift (keyboard) or X (x-box controller), a timer counting at 10x real-time is started and Hensen's movement speed is increased with respect to the sine of the timer's value. The timer ends at Pi seconds.

code_kz9bgdkieq.png

I chose to do it this way because using the sine function as a multiplier for the increase in movement speed has the effect of blending the dash in smoothly so long as my timer starts at 0 and is stopped at Pi (because sine 0 and sine Pi both equal 0 and sine anything between those two values is a positive number <= 1). In order to modify the duration of the dash or the speed of the dash, I can simply multiply Time.deltaTime when incrementing the timer or multiply the Mathf.Sin() call respectively.

I then capped the movement speed increase to a value I can modify from the inspector which has the effect of making it so increasing the multiplier on the Sin call beyond that speed increase cap, rather than increasing the movement speed increase during the dash, increases what you could call the abruptness of the dash.

Much like everything else in my PlayerController script, the dash is triggered in the Update method based on the player's input read from the InputManager and the HandleDash method only modifies values related to Hensen's movement, which are used in FixedUpdate where the actual movement of the character in the scene is performed.

code_ymwwk7nnyn.png

One thing I'm thinking about adding to this is actual variables for the dash duration and dash abruptness (aka the multiplier on the Sin call) that I can modify from the inspector. The dash abruptness is fine, I'd just need to do a bit of planning for dash duration. I know there is a way to normalize the duration into seconds, I just need to work out algebraically what the formula is for this and then implement that into my code. I also plan on adding some effects for the dash to make it easier to tell when you're dashing which is an entire other task.

Thanks for reading!



0 comments

Loading...

Next up

Working on getting the itch page for Hensen Hopper set up which means creating a separate cover image for the game on itch (different aspect ratio there). I want to publish that with first beta build of the game so I DO need to get a move on with it.

I added an animation and sound effect when the player collects the heal-up drop. In the lore, this flower is going to be Hensen's favorite food which is why the sound effect is a crunch like he's bitten into something.

It's unfinished but the backbone of "The Garden" is now visible in the main scene! I want to add a lot more to this backdrop later today and over the coming week.

Our 2024 Advent Calendar has opened! Day 18: @Otis_Le_PoOtis is the Creator of Bondee’s Barnyard and posts updates about their dev journey and their work on the sequel!) Accept the quest and give them a follow to get Coins and a seasonal sticker!

I have created a functional settings menu! I definitely want to spend some more time on the artwork for it but for now I'm satisfied. Everything seems to be working as it should.

Happy #WIPWednesday!

Are you working on a game?

Making some art?

Practicing a song?

Something else?

Tell us in the comments!

Been working on the visuals for the settings menu! I had the idea at the last minute to have the volume slider knobs each be different colored flowers which I think looks really cool. I left some space below them for extra options I may add in later.

I spent a really long time on this, I've been here since literally 3 in the morning (it's 7AM as I type) but I really like how it came out!!! The backdrop I had done before didn't feel like it fit with the aesthetic so I re-did it completely.

@Miles_Games is a Jolter to Watch! They post great game dev updates about the holiday-themed platformer TEAM SLAY-BELLS! Follow them before the quest ends on December 24 and you'll get Coins!

The new heal-up drop in Hensen Hopper. May not be a cameo of something in one of my earlier games like I may or may not have directly stated I was going to make it in a post I made the other day.