Sabbatical Log: November 19th

This blog series is running about a week behind my actual work, giving me time to clean things up.  The date the actual work was done is in the title, horizontal lines indicate when I stopped writing and started coding.

With some refinement to the existing sword and collision systems, I’ve got “push back” working when the sword collides with something.

It can be kinda hard to see in the gif, but the direction of push back depends upon the angle at which the sword hits the obstacle. I also implemented some new walls, the only thing notable about them is that they have two collision layers: one in the “floor”-level the player’s feet are in, and one in the “middle”-level that the sword is in.

It’s a little easier to see with the FPS of recording cranked up, and the collision debug layer turned on.

Next up, I’m going to make some bushes that can be cut – these will be the first destructible obstacles. It feels good to be getting dangerously close to “a game,” even if its almost 20 days in.


An aside, while I’m still working towards bushes. The flexibility of Entity-Component-System again comes through: I can easily model an entity with a hitmap that “extends” through multiple levels by just adding multiple level components.

So, this chunk of code

gets a bush that mostly “works,” despite it being a new thing. How I’d model this in classic object oriented style doesn’t immediately come to me, and it seems like when I did puzzle it out it’d be more complicated.

Here’s how it behaves, right now.

(collision on the player, and the sword)

 


Bushes now explode into leaves when hit with a sword.

As with the sword, there is now a BushSystem that receives events and handles the life-cycle of a bush. You’ll notice that cutting a bush still pushes the player back and ends their sword swing – which would be rather frustrating. While it’s tempting to just put “if sword” and “if bush” checks into the appropriate places, instead I’m going to add TakesDamage and DealsDamage components and check for those instead. In theory, this will make other damage sources interact better with bushes and make other “enemies” interact better with swords.


At the end of the day, I’ve got the sword and bush interactions working perfectly.

Tomorrow I’m going to spend a lot of time paying down some debt in entity management, and probably some other general performance improvements.

Continue onto November 20th