Asteroids Plus 2.0 - Milestone 11– bullet hell…


So, I have my asteroid entities and my ship (player) entity.  Next entity for development is going to be the bullets that fire out of the player’s ship.

The bullets will need to be sized with respect to the ship.  So, I will calculate the entity size based off that value.  The bullet’s creation will be in the fire method of the ship, and it will just create an object each call and add it to the entity list.

There are two fire points on the ship, and it shall toggle back and forth between them.  So, I need to create a way to ‘track’ the spawn points for the bullets at any give time.  Also, their velocity needs to be ‘fast enough’ so that its not practical to out fly them in your ship… that might become a max Velocity for the ship rather than influencing the velocity of the bullets.  The ship’s angle will become the angle of the bullets.

The exist and move until they hit something and are destroyed at that time.  So, they need to be able to destroy themselves.  The edges of the screen destroy them as well, this manages the overall number of entities that I’m trying to manage.

We will address the collisions in the next entry.  This one focuses on the entity creation, and movement.

There ultimately isn’t that much going on with a bullet, the only special method now is the destroy method, which isn’t a big deal either.


With the texture added and toggling between the two spawn points, I get something like this.


Not the best screen cap of all time but you can see the 3 bolts being fired and the positions are toggling back and forth, off the nose of the ship.  They are approximately +/- 10 degrees off the tip of the ship.

I played with the velocity a bit, and might adjust a little more in play testing, but I’m happy with it.

The actual spawn points are calculated in the data model as getters.


This allows for me to continually track their position at any point I’m firing.  Now that bullets are flying… its time to address my nemesis… collisions.

This currently hosted game site: https://asteroids-revisited.vercel.app/

Twitter: @jyoung424242

SlideShare: https://www.slideshare.net/JustinYoung3/next-gen-asteroids 

 GitHub: https://t.co/utxHxXKdOz

Leave a comment

Log in with itch.io to leave a comment.