DalwyX
March 13, 2019, 10:43am
1
After completing the Unity 2D course, I decided to make a full game based on the Block Breaker Project.
Available to play online
Main features:
Infinite game loop with unique random levels
“Color Breaker” mechanics as the core of gameplay
Smart Boost and Magnet mechanics for advanced ball control
New style with dynamic color palettes
Lives system
Statistics menu and much more …
6 Likes
DalwyX
March 13, 2019, 10:46am
2
In addition, for those who struggle with boring ball loops. Here is my solution
Ball.cs
[SerializeField]
[Range(0.1f, 0.99f)] float maxDelta = 0.95f;
[SerializeField]
[Range(0.1f, 0.99f)] float correctionValue = 0.2f;
...
private void OnCollisionEnter2D(Collision2D collision)
{
AdjustDirection();
AdjustSpeed();
...
}
...
private void AdjustSpeed()
{
if (Mathf.Abs(currentSpeed - (targetSpeed + additionalSpeed)) > Mathf.Epsilon)
{
Vector3 normal = rigidBody.velocity.normalized;
rigidBody.velocity = new Vector2((targetSpeed + additionalSpeed) * normal.x, (targetSpeed + additionalSpeed) * normal.y);
}
}
private void AdjustDirection()
{
Vector3 normal = rigidBody.velocity.normalized;
if (Mathf.Abs(Mathf.Abs(rigidBody.velocity.normalized.x) - Mathf.Abs(rigidBody.velocity.normalized.y)) >= maxDelta)
{
if (Mathf.Abs(normal.x) > Mathf.Abs(normal.y))
{
normal.x = Mathf.Sign(normal.x) * (Mathf.Abs(normal.x) - correctionValue);
normal.y = Mathf.Sign(normal.y) * (Mathf.Abs(normal.y) + correctionValue);
}
else
{
normal.y = Mathf.Sign(normal.y) * (Mathf.Abs(normal.y) - correctionValue);
normal.x = Mathf.Sign(normal.x) * (Mathf.Abs(normal.x) + correctionValue);
}
rigidBody.velocity = new Vector2((targetSpeed + additionalSpeed) * normal.x, (targetSpeed + additionalSpeed) * normal.y);
}
}
Reaver
March 14, 2019, 11:41pm
3
A really nice version of Block Breaker. You really put some features that makes the game fun to play. I wish I have much more free time to give some new features to my version of Block Breaker.
Here are my statistics
Hey DalwyX,
Congrats on finishing the course! (:
I really like “glowiness” (is that a word, lol) of the colors, and the polish you put into the game.
I’m assuming there is no end to the number of waves.
Wow nice game, but I have a question. How exactly did you make it so the balls had lives?? I wanna do that in my game but don’t know how. Please respond soon.
This looks amazing @DalwyX , Would you mind sharing how you created the random grid? I don’t recall it being shown in the course.