Learn and Dev Vlog: Day 2 - Animating the Crosshair
Hey everyone!
I'm thrilled to share that I've made it to Day 2 of my game development journey, and this feels like a massive achievement for me. In the past, I've struggled to stay motivated for more than a day, so this is a big win!
Today, I focused on creating and animating a crosshair for my game. The idea was to make the crosshair spread out when the player is moving, adding a dynamic feel to the gameplay. It might sound like a small step, but trust me, it's a huge milestone for me.
As a beginner in game development, I'm learning a lot along the way. Today, I encountered an error while working on this feature. The error message was:
No constructor of "Vector2" matches the signature "Vector2(int, Vector3)"
This error occurred in the following line of code:
RETICLE_LINES[0].position = lerp(RETICLE_LINES[0].position, pos + Vector2(0.0, -speed * RETICLE_DISTANCE), RETICLE_SPEED) # for top of crosshair
To fix it, I modified the code as follows:
var direction = (vel - origin).normalized()
var speed = Vector2(direction.x, direction.z) # Convert direction to Vector2
RETICLE_LINES[0].position = lerp(RETICLE_LINES[0].position, pos + Vector2(0.0, -speed.length() * RETICLE_DISTANCE), RETICLE_SPEED) # for top of crosshair
By converting the direction to a `Vector2`, I was able to resolve the error and get the crosshair animation working as intended.
I'm really proud of this progress and can't wait to see what tomorrow brings. Stay tuned for more updates on my game development adventure and as always, your feedback is welcome!
Happy coding! 🚀
ABSURD
Warning ! This game is absurd. Play at your own risk!
Status | In development |
Author | Be cool rusty |
More posts
- Learn and Dev - Day 5Jul 26, 2024
- Learn and Dev Day#4Jul 25, 2024
- Learn and Dev Day 3 - Debug PanelJul 24, 2024
- Learn and Develop Log , DAY #1Jul 22, 2024
Leave a comment
Log in with itch.io to leave a comment.