Digital Portfolio
2D Platformer
Concept
My ISP group decided to create our own 2d platformer game, similar to mario, using swift.
Motivation
Our motivation for our ISP game was that we all grew up playing 2d platformer game such as mario, so we wanted to make our own take at a platformer.
Code Segments + Explanations
This code was for our character. We made an animated stick figure by implementing frames of the stick figure running into an array. Using the array we were able to have an animation cycle, making it so our character is running. We made two sets of animation cycles, one for the character moving forward and another for it moving backwards. We also made it so we have an idle frame, so our character is not just stuck in a running stance. Finally we added physics to our character by allowing it to jump. We accomplished this by using velocity.
This code was for the lava. We made our lava using a rectangle but gave it a boundingRect, allowing the computer to determine whether our character was making contact with the hit box of the lava. Once touching the bounding rect of the lava, the character would respawn at the start of the level, giving our game an obstacle.
Conclusions
Our code did not go as expected as we did not take into consideration how complex a simple 2d platformer could be. We ran into trouble with working the physics of the game as it was difficult implementing gravity to our character. We were able to persist and resolve this issue by applying what we learned in our final projects on codermerlin.