Cuphead vertical slice
Cuphead vertical slice was an assignment where you as a group had to recreate a 10 second clip from the 2017 indie game cuphead to the best of your abilities.I want to showcase 3 of my contributions to the project, the boss, the movement of the platforms, and the animation system.
The boss
I've made the ai for the boss explained in the image on the right, I'll talk about the ai for the platforms later, but first I'll show the code for the boss itself.
Here you can see that I did the Boss' vertical movement with a simple sine wave, making him gently bob up and down, je "Bonus" varable makes it so that when the boss loses all it's health, the bonus drops below zero, making the boss plummet, and making the player win.
The platforms
The platforms are very simple, they start by checking their own y-position, and saving that, after that they're constantly moving up and down with a less intense sine wave. When hit with a fireball, they fall off screen, at which point a timer starts counting up when this timer hits 4 seconds, the platform comes back up, until they've reached the y-position saved at the start. When they're back at their original positions, they become hittable again by the boss' fireball, and the player can jump on them again.
The animation
The player's animation gave us a bit of trouble until I came up with a solution. The problem came from the fact that cuphead has an animation for walking, jumping, shooting, and walking and shooting, and those animations overlapped a lot of the time. It wasn't uncommon for the game to play the walking animation, then jump, but because you were still moving mid air, the walking animation would play. My solution was to implement a binary system, where jumping, shooting and walking were each a bit in a 3-bit sequence, the first bit(4) being jumping, the second(2) beingshooting and the third bit (1) being walking. When you start walking, the walking bit adds 1 to the animation integer, along with the other two bits and their respective value, for example if the player is walking and jumping at the same time, the integer will be 4+1=5 and thus the corresponding animation plays, being the "walking while jumping" animation. If this is still unclear, I hope the image I made below will clear things up.