Week 10 - Sub pixels, Corners, Source Code (Patreon)
Content
The Action RPG & Sub pixel positions.
In RPG land I've finally settled on a collision system I'm happy with. This time moving away from my usual strategy of only moving in integers and risking some time in the wild with sub-pixel positions (cue gasps). If you don't know what this means, don't worry about it. The TL;DR is that we're doing something that isn't necessarily my personal favourite method but that should prove more "Beginner safe" when it comes to you expanding the project beyond the scope of the tutorial.
For those who want the longer explanation:
As I've discovered in my own projects (PokeyPoke especially) the fractional storage that I do to maintain pure integer positions can cause a lot of unintuitive hiccups. Mostly in needing to reset stored fractions whenever you 'set' a speed in future and looking after what happens to them when you adjust timescale, etc. These issues aren't unmanageable by any means but the issues they cause are sometimes hard to notice in the first place if you've fallen into the trap. The usual symptoms are inconsistent jump heights and move speeds in specific circumstances. That can make it hard for beginners to debug. Truth is I don't know if this new approach involving some rounded checks and letting our X and Y positions roam wild, floating point and free will cause its own problems. But we'll cross that bridge if and when.
Walking around corners
I've added something to the basic movement that is subtle for the chunk of extra code involved but I think really adds that touch of polish that most tutorials and beginner projects lack. It's the type of thing I try to involve to help push people past beginner and into intermediate thinking. What I've added is a small movement nudge that helps the player walk around a corner if we're pretty sure that was their intent; in other words, they just barely collided with a wall:
Source Code
For the $20 folk I've decided to let you in on the source code for this as it develops. I'm disclaiming it here as obviously not-quite-ready but I thought it might be of interest to you to see the code early behind the scenes.
Link an itch account and get access here: https://shaunjs.itch.io/shauns-action-rpg/patreon-access
If asked for a password it is: LulusAdventure
I'll be trying to update the itch page regularly! Ignore the absurd price on the main project page that's just to prevent others getting access.
Other Stuff
Livestream as usual this Friday. Unsure what it'll be about though! I've got lots on my plate as well as this RPG stuff. Some excellent progress has been made on PokeyPoke and I'm looking forward to sharing more of that with Patrons too!
-S