Yo Twin!
Finally there are enemies!
But here is everything I did:
1. My own sprites
I thought of a good theme for the game and now the enemies are birds (because of bevy, yk) and you are the hunter. And it isn’t top down anymore and the gun follows the mouse and not the player.
2. Infinite map
I deleted the old map and just changed the background color. It is just cooler I think.
3. Zoom
You can zoom out. That’s important for later when there are more enemies
4. Removed Walls
I removed the complete collision system rapier2d. It is just to heavy for the enemy and bullet collision and I don’t have walls anymore
5. Enemies.
There logic is very simple. The code just searches the direction to the player and then it goes in that direction.
6. The best part: The enemy kill system
Here’s how it works:
- I get all bullets and their position in one vector.
- I do this: if bullet_pos.distance_squared(enemy_pos) < 20. and
checks if the euclidean distance between the bullet and the enemy is under 20 - If it is true I delete the bullet and the enemy
I saw others do it not with distance_squared() but with distance() but that squares roots of a number and thats to heavy.
Without it, I can spawn more enemies.
In the video you can see the enemy counter in the left bottom corner, btw.
Ok that was everything, I think.
Bye Twin!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.