Devember Day 24
So much for taking a day off implementing new features I guess. I added a slight improvement to the collision detection algorithm, which results in the player getting nudged only if they are near the edge of an object. I realize that not everyone wants to see the code, and since the collision detection code is getting quite long I'll upload it for those who want to see it (here), and for those who don't, read on!
I also allowed the player to swing their axe even when not near a tree, because it felt like the game was trying to control you too much otherwise. I also made wider trees take more hits to chop down, although I think all trees have the same width at the moment.
After that I spent a while implementing an entity system. When a tree is chopped down, it now drops a log entity which has a certain life span and a position somewhere around the tree. Upon pickup, a little sound is played and your wood count increases. The sound gets a little annoying, but it's alright I suppose. I'm not sure what the use of wood will be in the game, or paper - which I basically just randomly decided to add to test my CSS. But I definitely like having to pick up the wood yourself rather than just seeing the tree magically disappear. The log entites bounce up and down along a sine wave, mostly so the player realizes they aren't stumps. One further thing I could add to make the animation even better would be to drop each log from a specific height, as if it was popping out of the tree.
Here's what the entities look like currently:
I realize that they're a little bit ugly, and they don't quite match the stumps. But I'll call it programmer art, so it's good to stay for now.
That's it for today though, thanks for reading, I'll see you in the next one!