Tunnel Traversal

We are back in Modders Club again today and we are working on Tunnel Traversal!

Tunnel Traversal
I hope you all had a wonderful Bank Holiday! We are back in Modders Club again today and we are working on Tunnel Traversal. In this fun game, the player moves along a side-scrolling track and has to jump over on coming obstacles. The further the player gets without bumping into the obstacles, the higher the score they get! Last week's Guided Hack involved us creating a track on the top of the screen in addition to the previous one on the bottom. We modified the code to ensure the obstacles could spawn on both tracks and we also included a button which meant that the cube could switch between both tracks - neat!
This week's Guided Hack is a fun and simple animation hack, which makes the cube spin when it jumps - giving this game some more fluidity. To do this, we build two functions; one which turns the cube clock wise and one that turns it anti-clockwise, depending on which track it is running along. Both functions manipulate the y-axis to make it so the cube is no longer overlapping with one of the tracks, then whilst it doesn't overlap it continuously rotates by 10 degrees. Once the cube makes contact with one of the tracks again, we set the rotation back to 90 degrees so the cube is now in the correct position. Then the functions get called upon the A-Press button which operates the jump. A really nice bit of code which you can add to a multitude of games 😃
The theme for this week's Gam Jam is Strange Sports - I want to see your craziest and funniest sporty creations! Show me what you got!


Chat to our mentors