Updated: Jul 5, 2021
So, if you saw my previous post, you know the predicament I am in. This is the first post where I will actually show off what I have done and how I have done it. Apparently the how I have done it is important, so I’ll forgive you If you find that part boring.
So, the day before I was heading home, which happened to be a Thursday for all of those interested, I got bored of a lecture and started staring out of my window. I had just completed two essays that were due in that day, so I was feeling pretty proud of myself, but I also knew I had to start on the mod soon. While I was staring out of my window, I picked up my whiteboard and started drawing the default flappy bird level.
I was inspired by the trees outside my window and decided to incorporate them into my level. So, I replaced the pipes with branches which gave the game a very different look and feel. Also due to my incapableness to do art the bird looked a bit like a seed, so I decided to turn it into one. Then I realised that it would be better If the whole thing were on its side as then you’re guiding the seed downwards rather than from left to right. This also meant that now you had to move left or right in order to avoid the branches rather than up or down.
Sorry about the terrible drawing, I cant art.
Now that I had a plan of sorts I could begin working on the project. So today, since I had to move back home due to COVID-19, I opened up Unity and had a look at the flappy bird game. Then I may have played flappy bird for a little while… It was research! and totally not a distraction.
After a little while, I located the “RepeatingBackground” Script which looked like the script causing the game to scroll from left to right.
Put simply, I was wrong.
After fiddling with all of the co-ordinates and changing “0, 2f” to “2f, 0” for a while it turned out that this script wasn’t being used at all! After this small debacle, I looked for another script that could have been controlling the scroll direction. There it was, “ScrollingObject”, the script I had been looking for, the script that made object move across the screen and the script I was about to butcher in order to try and get the game to move vertically rather than horizontally.
I’d just like to mention that I am in no way a programmer and I have no clue how to code, so naturally this was going to be interesting.
I couldn’t see anything that was obviously an X axis in the script that I could change to a y but there was a few lines that said “(GameControl.instance.scrollSpeed * depthmod * direction, 0)” and I assumed that the “0” was the Y axis so I promptly switched them around to make “(0, GameControl.instance.scrollSpeed * depthmod * direction)” instead. Surprisingly this actually worked and now the screen was scrolling on the vertical axis but also jolted back after a second.
To fix this I looked at the game controls script to try and find out what caused the game to be over. Here I saw a handy note saying that if the bird doesn’t get a score, the bird will die. This means that I had to change the pillar prefab now in order to get it working. I began by finding an image of 3 branches in a cartoony style that I then made into 6 separate Images, each branch from the left and the right. I took these images and replaced the sprite images on the pillar prefabs with these. I also re sized all the colliders to fit with the new layout.
Stolen from google, Background vector created by brgfx – www.freepik.com
After doing this the scrolling actually functioned for more than a second, but the scrolling was the wrong way around. The bird was going up, rather than down which was obviously an issue. I firstly tried to change the direction and depthmod of the background and pillars which didn’t help. Then I had the genius idea to put a minus in front of the code that I originally changed to make it scroll vertically rather than horizontally, and to my great delight this worked perfectly. After this I ran into a small issue where the background was messing up so I simply made it the child object of the bird in order to get it to move with it. This works fine and the scene is now set.
Tomorrow I want to get the controls working and if I have time, set up a bunch of different branch prefabs ready to start procedurally generating.