So this week has been interesting, if not, frustrating. Before I explode your minds with the issues I have been having, let's just take a step back and enjoy the little victories. Firstly, I've managed to implement a few small 'juicy' elements for the 'Puncher' as well as adding a few more animations to the character. The punch effects where fairly simple to implement.
Firstly the dust clouds. To increase performance, rather than creating two different dust clouds (one for left, and one for right), all I did was create two of the same actor, and just flipped one -100% along the horizontal axes.
As for the camera shake, less is more, too much, and it's over kill. Playing with the subtle amounts really worked for me to find a happy value.
I had also create some simple death animations which I would really love to push throughout this game. I feel that having funny deaths of a character gives the game not only personality, but some moments as well. Death animations really take me back to 'Crash Bandicoot' days, so implementing something like that would really top it off.
The first death animation implemented was for the 'Puncher' mechanic. If the player was in a certain location above and below it's starting location from when the puncher trap impacted, the player would die.
This was actually quite tricky to set up. Firstly, I needed to check whether or not the player was roughly around the area where the 'Puncher' impacted, otherwise, the player would still die even if it was a lot higher up since it still technically 'collided' with the trap. So, I needed a reference point from where the player characters X, Y coordinates were when the puncher trap first spawned. Then once the trap fell to the impact point, it checked whether or not it collided with the player's top collision point, as well as checking whether or not the player was still in that same location.
The other problem I was having was the player essentially had to stand still in order to die. So i had to widen the 'touch' location, so then if the player had moved slightly up or down, then the collision would still happen (roughly 20 +/- in the Y direction from the original location seemed like a sweet spot).
Basically, whether I moved slightly or not, I would die if I didn't move completely out of the way.
So once I had a grasp of the 2D-flat-detection-collision-location-stuff, it was finally time to move on to something fresh. A new mechanic! I created the 'Buzzsaw'! I viscous saw-blade which pops out form the ground. The... only... thing I still need to do with this is to actually get it to work... Which is on my to-do list! I still need to implement a death for that, as well as make sure it constrains to the boundaries of the game environment. Easy fixes, but ones which still need to be done. Also, let me know what you think about the colors; will they stand out, will it be funny enough, or whatever. Let me know!
After all this success, reality had to come back for another round. There was still something that was 'urking' me, and that was the layer ordering of each asset. What's that you ask? Welp, essentially layer ordering (or z-layering for short) is a type of thing needed to move an actor or image up or down within a particular layer without adding a crazy amount of new layers. The problem with this was that each asset within the level moves. And this being a 2D game, with basically zero 3-dimensional space, was quite difficult to figure out. Trust me, I spend ages on trying to sort out when and how these assets should work with layering. I did however manage to find a useful resource which helped understand how I could approach this. Now, without going fully into technicalities, I'll try and explain the process:
I firstly had to make an array (or list in my case) which was empty.
Then, from that list, I had to identify each actor within the layer I wanted to affect
I needed to add that actor to the list, and if it was the first actor added, then be done with it. However, it this wasn't the first actor in the list, then i needed to create a 'zIndex' attribute (integer variable)
I also needed to check each actor in the list before it and check whether or not it was lower or higher in the Y axes (Up axes).
If it was a higher value, then do nothing, but it was lower value, then decrease the Zindex by one for each actor in the list.
Then finally, insert that new actor into the correct index within the list.
And since each actor moves all the time, I needed to have this in an updated event.
Yup, fun. But I eventually got there. There are still a few tweaks to push out, but it is working at a fairly good point.
Overall, I'm pretty happy with this progress. I'm hoping by the end of this week I will have the Z-Layering under control, as well as the Buzz-saw mechanic.
That's about it for this week. Stay tuned for more next week!
Enjoy, and thanks for reading.