Gamejam & pong
Here I will talk about how I approached the 48hr challenge to make a game but also explain how to make Pong.
Background
Firstly, what I did was look for different sprites that I liked in the Unity Asset Store and I started building my background with different assets; then i chose what to put together.
This part was extremely fun because I love making background for my games and I love setting a mood for the scene. With the background I put together I wanted the player to feel calm... almost like an ethereal feeling. Also the trees would help to add a sense of mystery to the game together with the moon. Usually a full moon represents witchcraft and evil. This is backed up by different cultures, especially satanism. Satanism has a lot of different rituals but most certainly a lot of them are done during the night.
Sprites
For the sprites I wanted to add something related to angels and demons because my theme for this challenge was Light and Dark. So in order to represent that my mind automatically went to the depths of hell. The left sprite is an angel and the right sprite is a demon.
My favourite one is the one on the left because I feel like there is a little more detail at least in my eyes and I think the gold on it and the little wings look extremely good. The demon also looks quite good but he has more of a demon knight appearance which is not entirely my cup of tea. Nevertheless, both fit perfectly for my game and the theme. After I picked these beautiful sprites, I needed to animate them to make them move. First you would need to add an attachment called Animator. Then I had 3 different pixel arts of the angel (which were 3 different states) and I had to cut them equally to make sure that it doesn't move in weird ways or move too much to the left or the right. After they are cut I opened the Animator tab (Ctrl +6 ) selecting my angel and I dragged in my 3 cut pieces. Then i had to find the perfect timing of making the animation happen, if it was too slow it would look weird but if it was too fast it would also look wrong. So with my testing I came up with 7 seconds and the intervals of 3 seconds.
I tried plenty of intervals but 3 seconds does seem a little fast but it doesn't seem wrong. When I tested 4 seconds of intervals it felt way too slow. After all this work is done you can simply drag this into the animator and it should move. I repeated these steps for the demon as well.
After I got all the animation out of the way I added different plugins to my sprites as they work as "paddles", since this game is heavily influenced by pong. I had to add "Box collider 2D" and "RigidBody 2D" and then set gravity to 0 so our little characters wouldn't be affected by gravity. All these plugins would make our sprites to be considered as paddles. I also used the function "Constraints" and checked "Freeze Position" for the values of X and Z. So this makes my characters only move on the Y axis.
Ball Sprite
Making the ball Sprite is very simple. I found a pixelated bullet from a ship which then I cropped out and used it as an actual ball which is used for my game. I thought that the colour blue would fit in perfectly with the background. There is only one thing that I do not like and it is how it looks too pixelated .
Borders
Setting up the borders is very simple all I did was insert a sprite (Square) and shape it in the way of a rectangle. Then I moved it into the position that I wanted.
Then all I needed was to add the following plugins and i repeated the same process for the rest of the borders (around the edges).
Then I decided to add little bars in the middle just for visual aesthetics, they were just added without any plugins because I didn't want them to act like walls.
Coding
I started by coding my sprites then finally coding the ball. The most difficult was coding the ball because of the way that it moves and reacts with the different plugins. But i did certainly enjoy coding my own game and Pong. As my game is heavily influenced by pong and I had to re-write a lot of coding it did teach me how to code different things and understand them more because of the mistakes that I have done.
Angel coding
The first thing I started with in my code was to set-up my keys to be able to move my angel up and down. At the end of every code you need to add ";" to finish a command otherwise your coding will not work as intended or work at all. "Void Start" means the actions that will happen at the start of the game, this could be letting the console know something or making an action.
I wrote this in "void start" because I had to make sure that the Rigid variable recognises the "RigidBody" that was attached to my angel. After this I added coding so that the console would understand that I'm trying to move my spirte and how much it should move.
"Void update" means what will happen every second. The code basically means that "if" the key "up" is entered/used then this is what the sprite would do. "Else if" would make it do another action if the button "down" was pressed. If nothing is pressed the sprite will not move. This code also means that when "up" or "down" is clicked the sprite will move 7 units per second positively or negatively on the Y axis. I repeated the same coding for the demon as they are both considered paddles. After the coding is done I just attached it to my "Angel" and the coding for it is done!
Ball Coding
I also added "Circle Collider 2D" and "Rigid Body 2D" to the attachments to the ball. With the ball I started with making "Physics Material 2D" which would make the ball bounce. I set the friction to 0 and bounciness to 1. This will make sure that the ball will never stop bouncing. You would attach this to the ball in the "Rigid Body 2D" so it takes an affect on the ball's physics.
After I got this out of the way I started on my C# script.
I wrote the code "Rigidbody2D rigidBody;" because this will allow me to have access to the rigidbody of my ball and later on I can make it do different things, but for this game I will apply force to it so that when the ball hits a wall or a paddle it will bounce right off with a certain amount of force. If this is not done then the ball will not work properly.
I have made a "Public Void" to be able to start coding the velocity of the ball.
"direction = Random.Range(0, 2);" Means that there is a random generated that will pick a number which will be 0 or 1. This will cause the ball to have different velocity each time. After all the coding is done I just attached it to my ball and hopefully everything should work as intended.
Overall Opinion
Gamejam
I personally really loved working on my gamejam as it was something I'm very interested in. I think I did a really good job on the background which I completely adore. I had a lot of issues with my game as in the beginning of the challenge I was completely stuck. I had a lot of issues actually remembering the codes and how it should all go together. So I spent around 30 minutes or more on the first day thinking how to start this and my anxiety was kicking in. I was so lost so I remembered to just do what I enjoy and that is decorating thing or making things look pretty. So I started with the background which flourished into a very dark and mysterious setting, which I love. I have a tendency to naturally gravitate towards dark and creepy things. For example, demons. In the end everything worked out and things were fine. As soon as I went home I started researching about it and things went pretty smoothly. I do wish that I would of added more things to it but I ran out of time.
Pong
Making Pong was always a fun experience, It was one of the first games that I really put a lot of time and effort into a game and it came out great! I found making pong quite easy which is why once I slowly refreshed my memory things came back to me when I needed that knowledge again. There's so many things you can do with Pong that can be interesting. A few ideas are: you can add blocks in the middle and break them with the ball so the ball can pass through ( a classmate has done this ) and you can also have more than one character just in front and behind, almost like tennis! That could be quite interesting but it can have its down effects.