Posted May 18, 2025 by badwolf519
This week was a BIG week for the development of the game!
What I’ll be discussing this devlog:
Progress:
Starting strong this week the first thing I set to tackle was implementing a win state for the level and Level Complete scene overlay.
Win State & Level Progression
I was able to quickly get some code written and added a trigger zone in the bucket for the ball to interact with.
The logic for the code was pretty simple, when the ball is in the bucket's trigger zone for more than 3 seconds it triggers the Level Complete scene to load additionally to the current scene (over the top).
I did have an issue with the ball not triggering for a while, it turned out I forgot to add “2D” to the “OnTriggerEnter2D” and other bits of the trigger code.
After that frustrating amount of time I then started work on what I though would be placeholder UI for the Level Complete scene. It quickly turned into me deciding to do it as closely as possible to what I want to have for the end product in regards to UI and graphics for the menu system.
Simple Main Menu & Level Selector
Building off the style used in the Level Complete scene, I built a simple main menu and level selector scenes.
I used the scene selector script from the tutorial tasks for switching the scenes with the buttons I set up in the vertical button groups in the scenes. I spent some time using the graphics elements from the main game scene to populate the background for the Level Selector…
and used the logo, font (Horizon Wide) and concept image background to style the Main Menu
One of the issues I ran into after creating the menus were to do with player input. Once the scenes had been switched (especially the Level Complete scene) there would still be player input controlling the cannon and nothing in place for the menu’s since I was using an input system only in the scripts for the cannon’s controls.
Solution:
I had to write some extra code in the level complete trigger to turn off the gameplay controls so it wouldn’t work when the menus appeared. I set up the menu controls using the defaults in the new input system, something I also updated that I’ll cover later.
New Level & Progression
My first level largely stayed the same, I just removed the target as it didn’t serve a purpose currently and I want to introduce the bucket on the first level.
For the second level I decided to implement a bucket that moves, inspired by a level in Cannonball Follies 3.
To do this, I coded a movement script for the bucket that moves between two set points and dips on a curve. I will be able to use this script later in my additional levels I make.
I ran into a big issue when testing this though… due to physics the ball flew out every time when the bucket continued moving!
My first thought was to make the bucket’s collision sticky? Then I mucked around with the material properties to add friction which I then quickly decided to think of a different solution… leading to
A one way invisible lid!
Visual Improvements
Ian said to make the background have parallax, so I complied. (I did have plans to do this).
I used this fantastic tutorial to accomplish this and used their code as well. I found it to work brilliantly so big shout out to Game Code Library!!
I made the effect visible but subtle, especially being brought out in the clouds and stars. The most time I spent on this was not the implementation of the effect but dialling in the values of this layer moved at what speed.
I also spent a decent amount of time making the graphics continue vertically as the asset I’m using doesn’t tile vertically as it does horizontally. This meant I took the layers into Affinity Photo and used the stamp tool to extend some parts of the clouds, parts of the sky and made some new clouds.
Example of the height in gameplay:
New Input System & Controller Support
The final task I decided to tackle for this week was switching from the old Unity input system to the new Input System, the same one that I started using for the UI.
This meant I had to rewrite (but mostly update) the input code for the cannon movement and cannon power over to this new system.
This allowed me to really easily add controller support because the inputs are assigned with the Unity settings so I can just select multiple inputs now without even changing the code!!
What’s Next
This week felt like a lot! Very happy with the progress! I have the following tasks slated for next week, getting closer and closer to the end.
References:
Game Code Library. (2024, April 12). Infinite Parallax Scrolling Background - Unity 2D Complete Tutorial [Video]. YouTube. https://www.youtube.com/watch?v=AoRBZh6HvIk
Fontense. (n.d.). Horizon Wide Sans Serif [Font]. Creative Market. https://creativemarket.com/fontense/2189003-Horizon-Wide-Sans-Serif
Adwitr. Health Bar Asset Pack from itch.io [https://adwitr.itch.io/pixel-health-bar-asset-pack]
Nicolaspla77. Cannon from itch.io [https://nicolaspla77.itch.io/can]
CraftPix.net. Moon and Sea Pixel Art Background from OpenGameArt.org [https://opengameart.org/content/moon-and-sea-pixel-art-background]