physics

All posts tagged physics

Original drawings of the asteroids

Original drawings of the asteroids

It’s been a while since I last posted a update, but I’ve been really busy implementing things for my game. I started with creating the asteroids, I have four different types taken from the original asteroids game, as shown in the drawing to the left. The asteroids are starting a certain distance from the centre of the game plan so players have a safe spawning zone. The asteroids, 4 to 8 of them are started in their largest form. They simply float around on the screen and when destroyed they will spawn 2 smaller asteroids until they already are at their smallest.

Some physics had to be implemented. Even if it’s simple 2D physics they still took quite a while to complete. To start of I had to create a base ‘Entity’ class, holding the graphical content and some possible physics body. I should really have done this earlier but back then I had no need for it. Anyhow I started with axis aligned bounding boxes (AABBs). They are boxes that encapsulate the object and are always aligned with the worlds XYZ-grid. AABB is perfectly fine for the lasers that the players fire, but not so much for the asteroids so I had to implement a radius/sphere collision check as well.

I also implemented score, now when I have something to shoot at. Destroying a large asteroid yields 20 points, a medium 50 points and a small one 100 points. The large saucer will give 200 points and the small one 1000 points. I’ve decided to put the points from killing a player at 400, but this may be altered later. The score can be kept together in the group if playing in coop mode, or split into one for each player in versus mode.

I have lots of things left to do on my game, but I think I will start completing the menus and creating a game-lobby.

AABB & Radius/Shere collision

AABB & Radius/Shere collision

AABB & Radius/Sphere collision

AABB & Radius/Sphere collision

Radius and AABB

Radius and AABB

AABB

AABB

Asteroids in different sizes

Asteroids in different sizes

Asteroids

Asteroids