Monday, April 16, 2012

Infiltrator Part 19 - $5 feature bin

As predicted, this session was easy and time consuming busywork. It's pretty cool to think how I've set things up so that adding these features is so easy. It's kind of like building a good foundation for your Lincoln Log house, making it a simple matter to add a roof or some more greebles and nurnies. That said, don't expect any amazing, ground-breaking, or super cool features. This is merely another step forward.

I didn't even notice I had a read more button until recently.

One of the easiest features to add was the FPS counter in the top left corner of the screen. Since SFML(the media library I use) provides delta time in seconds, I can calculate FPS as [FPS = 1/delta]. Delta time in game programmer lingo means how long it has been since the last frame was drawn. This number fluctuates very fast, but still gives me an idea of the kind of framerate I'm getting. I should eventually find a way to normalize the framerate and cause my indicator to change less.

The next and admittedly more awesome feature was adding firing systems to the drones. I already have a base bullet "class" that I created awhile back for the players weapons. Class in programmer lingo meaning a classification of a kind of object, like a bullet in general, rather than a specific object itself. I can attach any image and damage values to a specific bullet object, so it was an easy matter to create more of them for the drones. Each drone object has four bullet objects it can keep on-screen at a time. I rigged the drones' firing mechanism to a debug key so that they fire whenever I'm holding it down. Currently they fire from the center of their ship, but I want to setup timed fire that alternates between their left and right cannons.

Making barriers absorb the player's bullets was also an easy task. I merely have to loop through all of the  on screen barriers and check them for collision against all of the on screen player bullets. Then all I have to do is send a message to any bullets that collide with a barrier telling them to vamoose. Unfortunately, I haven't had time to apply this to the drone's bullets or anything yet.

This is shaping up to be very interesting. It seems very plausible that I can eventually make the drones able to and interested in killing the player. Perhaps in a few months there will be substance enough to call this a game rather than a set of real-time interactive systems.


No comments:

Post a Comment