Today I forced myself to sit down and try and code the forth gun for my game, a shotgun. I put it off for a while because I couldn’t wrap my head around how to fire three bullets at the same time, with slightly different angles. But I tried a few things and did manage to do it, now time to tidy up the coding.
So far, my OpenGL C++ Top Down Shooter is coming along nicely. Some of the coding isn’t as OO as I’d like (due to my limited C++ knowledge) but I have managed to make a small demo, which I am going to continue to expand upon.
Basically, since my last post, I’ve polished everything fairly heavily. In 2D Graphics programming, one of the comments for my Lunar Lander game was the overly-complicated collision detection code, which I’ve managed to heavily update for this game. The collision detection is now one function call,, instead of 8 lines of coding and one function call, and there are separate functions which can test the direction of a collision as well.
I’ve also made everything a lot more OO, though it is still not completely (or as much as I would like) but I’ll keep going.
I’ve also added 3 enemy types; one is small, one larger (practically identical in AI to the smaller enemy) and one who shoots the player. The shooting-enemy is identical to the small one, except he moves slower and shoots the player. He can only fire one bullet at a time currently, and I may update this (though it actually works better than I expected with only one bullet).
I’ve also added health to the player and enemy. And I’ve updated my ‘test an object’s existence’ coding, which was unnecessarily confusing before.
I’ve added a couple of screenshots from the game right now. The graphics are fairly simple right now, but they will be updated further into development. I also plan on updating this blog more often, since I’ve been neglecting it recently and I am working on the game practically everyday so I always have stuff to say.
Sorry for the late-ish post :L. After finish university I immediately began creating a new project, so I’ve done a lot of work for it. I have created object translation to simulate a moving camera, collision detection for the player and blocks which allows the player to smoothly slide along the block, player rotating to the mouse, the player’s gun firing like a machine gun, basic enemy AI (see player, moving towards player, don’t see player, do nothing etc.) and I’ve made a small demo level (a maze).
The few problems I’ve had with the code I’ve manage to fix myself (usually the problem was rushed, messy coding). Here’s a quick list.
The player’s bullet not moving towards the mouse when fired, but the program was messy coding that I couldn’t really follow myself :L. The coding was cleaned up, more functions created and an array holding the vertical and horizontal speeds.
The player ‘getting stuck’ in blocks. This was because the block couldn’t tell which direction the player was coming from, and would stop their speed dead and the player couldn’t move again. I changed the code to detect what direction the player was coming from as well, and then stop the players speed accordingly.
Enemies walking through walls to get the player. This problem was because the enemy couldn’t see the player through a wall, but there was nothing stopping an enemy walking through a wall. So I duplicated the player’s collision detection code for the enemy to fix the problem.
Hi guys. This blog was created for UNversity 2013, hosted by Daniel Livingstone. It’s basically a ‘do something useful over the summer’ type thing. Some people work on a project, other learn a skill from a book.
Me, I’m going to make a top down shooting using C++ and OpenGL. My goal is to make something more complex that my 2D graphics assessment, yet still carrying on from where we’ve left off. The aim is to have something with translating objects (to simulate screen moving) slightly more complex collisions that a box, basic enemy AI, and a few other less programming features like switching weapons.
Also, I’m going to read about Software Design Patterns and learn some Java (since most software design patterns seem to be written in Java).
Hopefully, I’l become a much better programming by the end of summer and be ready for the second year of university!