Bullet Points

Leave a comment

March 10, 2013 by jonmillymiles

This week has been a difficult one – I’ve had to get my head around a few concepts within Actionscript 2.0 in order to achieve my goals… but achieve them I have. Rather than listing them all here, I’ll outline them as I move through each of my prototypes along with some of the thinking behind their use.

Prototype showing charged wave

Prototype showing charged wave

Ultimately though, I am beginning to realise that my whole code requires something of a rewrite. As you take an application and add functionality from one prototype to the next you learn more, you learn better ways and you spot inefficiencies. This is similar to quite a few stately homes where they have passed through several generations of ancestors and now feature Victorian structure, Edwardian carpets and Georgian windows… it starts to look a mess. I know it can be written better… I just need to stop chasing shiny new features.

I have a whole two weeks ahead of me to do as much of this as possible, and I also need to start work on my enemies so we’ll see how it all pans out.

Gun animation – To begin with I needed some slicker animation for when the player changed their weapons. The idea behind this was  to allow people to change their strategy depending on enemy type, but to do this they would have to incur a delay in their ability to fire. It may only take a second to swap, but you really don’t want to be doing that in the midst of battle.

Bullet Hmmmm???? – Yeah, this was my first go at producing a bullet. It worked, it was crude and there was only one at a time. But in doing this I used the attachMovie command that I had never used before. I found out about it by looking through about 10 different forums on the internet. Some were helpful, others not so: sometimes you just have to find the one that works for you. Sometimes, that can take a while. I’ve also got a variable there that says when the bullet has been fired, otherwise you would end up with it restarting and not moving to the end of the screen.

Bullet types – With this prototype I put in the code that changed the type of the bullet if the force was docked. This was to give the impression that you would have a more powerful bullet when the force was docked – my idea was to have a build up shot when the drone was docked and smaller bullets with rapid fire when it wasn’t.

Missiles – Ok, now that I can change the bullet type I also wanted to change the speed. In order to give this relevance I bought in missiles and bullets. The missiles are slower, but I intend them to be guided in the final version. Where as the bullets are faster, but do not target the enemies. At this point I was crudely using global variables to change things like the bullet speed and going back to my opening statement, I knew I could do things better.

Rapid Fire – Yeah this is broken, but not in a totally bad way. There’s a couple of things going on with this, firstly you can now have more than one bullet on the screen at a time, but still only one missile. I did this by placing my new bullet movie clips inside an array and then cycling through it each frame, moving each bullet in turn.Using an array also gave me a huge incentive to create a function for creating, moving and destroying the bullets. This is a more efficient way of coding and the thrust for my rewrite of the game code. I also want one central game loop with lots of functions rather than having lots of smaller loops with lots of global variables. This is called, if I remember it correctly, high cohesion and low coupling: maximising functionality and the reuse of code while minimizing the interdependence of functions/procedures/objects.

There is also a problem with this prototype: while you only have one bigger bullet when the drone is docked it auto repeats which goes against my idea of a build up. This needed sorting out.

Prototype showing charged shot

Prototype showing charged shot

Charge!!! – I fixed the bullet when the drone was docked. I also changed some of my code so that when the mouse button is pressed and released it now just toggles a boolean variable rather than actually creating a bullet. This means that I can now have a counter and every x-many frames launch a new bullet – rapid fire now works as intended. I also used this mechanism to start a counter when the drone was docked, when the mouse button was released this counter was then added to the scale of the bullet so that the bullet became huge.

Blast wave – But there was a problem with this, the size of the bullet was getting out of hand but it was taking an eternity to scale. I created a charge meter, based on the health bar and set a maximum limit of 100 frames, just over 4 seconds and gave this a +400% magnifier on the scale of the bullet. I then changed the bullet to a blast wave, it looks kind of cool, but completely ridiculous at full size (500%).

Prototype showing charged shield

Prototype showing charged shield

Resize and shield – My other idea was to have the build up create a shield around the player ship, this would remain until the player released the wave. So I created a shield based on the blast wave attached this to the Drone and linked it’s opacity to the charge level of the player bullet. I also resized the blast wave to make it more in keeping with the size of the ship… and not the size of a small planet!!

So, what’s left?

I have pretty much all of my player mechanics developed, I just need to implement the other player bullets, enemies, the enemy fire, the collision detection, the power-up system, the different backgrounds, the timing, the scoring, the level system, end of level bosses, possibly a map system for creating more interesting locations and a whole front end interface which links all of my prototypes into the finished game.

So not too much really… honest. Stay tuned to see how it all turns out. Until next time keep safe and stay well 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Stats

  • 9,998 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 580 other followers


%d bloggers like this: