Last time I checked in movement was a bit iffy in the sense of working more of a direction switching gravity mechanic from games like VVVVVV. For it work how I want it to I need a “neutral” state. This is necessary because of the “Vector Plates” I’m gonna tell you about!
Vector Plates are a complicated name for tiles in my game that are supposed to redirect your movement. Let’s say you pressed left and run into a plate pointing upwards. From that point you move upwards and stop moving to the left.
Issue was with this plates, that without they “neutral” movement state you will can get “stuck” in an endless loop. Let’s say you press up and run into a downward pointing plate. You will be redirected to down, but your root movement direction is still up, so you will immediately move back up, run into the plate, redirected down, hit the wall, root is still up etc…
With the neutral state you can set your root movement to “null” basically {0,0} technically and wait for the indication for a new order.
The only issue left from my old code now is with multiple actors if one steps on a plate then the global direction will be set to that and all objects will move. I only want the plates to work of individual actors, so we move the global gravity_dir is now not needed as we will handle things inside the actors. So now we have a dir member value inside them showing which direction they are moving if not redirected.
One last thing I wanted is little ponds you can traverse with Lilypads. Thing is I want them to break over one stepping through (or two in case of the flowering ones). This has two issues.
- I’m creating objects from them runtime so I can render them over tiles, but this means that I need to fix the underlaying tiles to look according to the shoreline.
For this I created a function which checks which way the shore is and puts the right tile there after creating the object from the lily.
- You need to set the tiles to walk-able under them. This is possible by giving a new flag value with fset() during the fixing, but fset() is global so when I set back the tile flags after the player breaks the lily all tiles under lilies are set to non walkable. This means you can only pass one.
For this I created a copy of my water tiles and that copy has the flags set so it is free to walk on. Upon you walking over and breaking the lily it fetches the non walkable counterpart under it so you cannot pass through. It’s kinda a hacky fix, but it works and I have free tileset space, so easy solution here we go.
One last thing is now the game loads the map from string data, letting you expand the number of stages until you ran out of character space. I iterate through the map, save the ID-s into a string, store it, fetch it runtime unpack it and loop over the ID-s and create the objects the same way I did last time, but now from a global map collection. I wrote this about in the very first devlog of mine for Clock mage, but here is the code for this cart!
And this is all I have for you today! One more Devlog probably before relase and then a post mortem in some later time!
Take care!