Journal 1
Date: 30.4.2024
Activity:
The first part:
-> Learn to rotate along the X-axis ;
->Learn to shoot.
Notes:
In the game, I decided to implement only two mechanics for the Space Rocket hero. The first is rotation around the X-axis by 180 degrees using the Space key. The second mechanic is shooting from the cannon using the Right arrow key.
When implementing these mechanics, I didn't encounter any difficulties.
Invested hours:
• Scripts: 1h 20 min
Outcome: Not yet
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Date: 31.5.2024
Activity:
The second part:
-> Learn to destroy asteroids with an explosion;
-> Create coin collectors;
-> Display how many points you've collected.
Notes:
The next day, I decided to add obstacles in the form of asteroids. I added a Circle Collider 2D to them to detect collisions with the rocket. After the collision, an explosion animation will be played. I encountered a problem with the animation. After the explosion, the screen would still display the last frame of the animation. I tried removing it after displaying, but it still remained on the screen. However, after a short period of time, I found what my mistake was and fixed it. I used the Destroy(Object obj, [DefaultValue("0.0F")] float t) function for destruction, and initially. I thought the animation object should be deleted after the time allotted for the animation, which is 5 seconds. But then I realized that the animation plays first and can be deleted immediately after playback. Therefore, the value for seconds is set to 0.5. I didn't encounter any other animation issues after that.
Next, I wanted to add collectible elements. So, I added coins, for which I added Circle Collider 2D to detect collisions with the spaceship. When the ship collides with a coin, the coin is destroyed.
I also wanted to display the number of rewards collected at the current moment in the game. Points are collected by destroying asteroids and collecting coins. To achieve this, I created a Canvas object and added text to it. By writing a script that helps to count the points accumulated at the current moment, I was able to display their quantity directly on the game screen.
Invested hours:
• Scripts: 3h 20 min
Outcome: Not yet
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Date: 1.5.2024
Activity:
The third part:
-> Character health;
-> Decrease character speed if it collides;
-> When the ship collides with an asteroid, it becomes slightly transparent for 3 seconds. And then returns its color bac.;
-> Add a countdown at the start "3,2,1, Go!";
-> Add a "Game over" and "You win" screens;
-> Destroy the bullet after colliding with other objects;
-> Finish line;
-> Increase speed over time during normal gameplay.
Notes:
I wanted to add an element that would display the current health of the spaceship. To do this, I used the Image object in the UI section. There, I placed images of hearts, and their quantity decreased when the ship took damage, which was managed by a script.
"I also wanted to add a visual effect indicating that the ship had taken damage. After the ship collided with an asteroid, I decreased its speed for 2 seconds and then returned it to normal speed.
_rb.velocity = new Vector3(7, 0, 0);
yield return new WaitForSeconds(2f);
_rb.velocity = new Vector3(speed, 0, 0);
I also wanted to make the rocket flash red. 'numberOfFlashes' is the number representing the amount of flashes that should occur over a certain period of time.
for (int i = 0; i < numberOfFlashes; i++)
{
_sr.color = new Color(1, 0, 0, 0.5f);
yield return new WaitForSeconds(0.3f);
_sr.color = Color.white;
yield return new WaitForSeconds(0.3f);
}
At the beginning of the game, I wanted to display an animation of a countdown timer that says '3,2,1, Go!'. To achieve this, I created an animation that played at the start of the scene. Then, I created a script that could manipulate time to start the game countdown. After the game starts, this script pauses time for a certain period and displays the countdown animations during that time interval.
Using Canvas, I decided to add two types of screens that can be displayed during the game: "GAME OVER" and "YOU WIN". By their names, it's clear what each of these screens represents. Each screen displays the number of uncollected points. "GAME OVER" is displayed in two cases: first, when the character runs out of health, and second, when the player fails to collect the required number of points to finish the game. The "YOU WIN" screen can be seen if the player collects at least the minimum number of points specified as the goal. Both of these screens are supported by the functionality of two separate scripts.
I didn't like that the bullet from the spaceship's cannon could destroy objects that were behind another object. Therefore, after the bullet collides with an asteroid, I delete the bullet object.
I also wanted to add a Finish Line with a Circle Collider 2D. This object is controlled by a script. When the rocket collides with the Finish Line object, the script triggers one of the above-described screens, 'YOU WIN' or 'GAME OVER,' depending on the points collected by the player.
I wanted to add an interesting element to my game. I decided to increase the spaceship's speed by 2 units every 2 seconds. The maximum speed the ship can reach is 30.
Invested hours:
• Scripts: 7h 40 min
Outcome: Not yet
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Date: 10.5.2024
Activity:
The fourth part:
-> Goal text;
-> Сorrection of errors during the game.
Notes:
I also wanted to display a goal that would help complete this round. Upon reaching a specific point value shown on the screen, the player can finish the game. To add text, I again used Canvas and a Text object. Additionally, in the script to display the current point count, I added another Text element that would be able to display the goal for the current game.
The main problem I faced was with changing the position of the spaceship after rotations to positive and negative 45 degrees. In short, I wanted to make the rocket fly relative to some 'Ground' surface, and the rocket had to follow its forms. To achieve this, I created inclines and declines on other planes. I tried to find such inclines using empty objects with Box Collider 2D attached to them. However, I encountered issues with changing the position at the top or bottom relative to these inclined planes. That is, at angles near the 'Ground,' which is positioned at a 45-degree angle relative to the horizontal line, the rocket could experience unnecessary rotations or shrinks. My solution to this problem was to start destroying these empty objects after collision with the rocket.
Invested hours:
• Scripts: 5h 45 min
• Build of project: 5 min
Outcome: ProjectC_Sample_Build.zip (uploaded to the itcho.io page as a .zip file)
Files
Get Project C
Project C
mff-gdintro-2024-c
More posts
- Journal 2May 20, 2024
- How to playMay 12, 2024
- Journal Project C IdeaMay 08, 2024
Leave a comment
Log in with itch.io to leave a comment.