Upgrades, Splosions, & OH GOD MISSILES
Above is some of the latest progress I've been making on my game. I've got missile barrages for the player (still spammable :P) and explosion/splash damage when a missile dies.
This turned out to be REALLY neat because whenever a missile explodes, it creates an explosion sprite. Whenever a missile (yours or the enemy's) collides with an explosion sprite, that missile explodes too.
This means you can get some really awesome chain reactions. In this way, your missile barrages can be as defensive as they are offensive. If a chain of enemy missiles is streaming toward you, and you detonate one of them, any nearby missiles will get caught up in the blast. You can now take out enormous groups of enemy projectiles far more easily.
Not that this necessarily will make things easier in the long run...
The other big thing I'm making progress on is an upgrade system. Now that I've gotten a few weapons built for the player, I figured it was about time that I break them out and make the rest of the game code less dependant on their existance. For example, in my previous code, there was lots of stuff like this:
if the.ship:isLasering() then
if the.laser.rotation < self.rotation + offset then
This essentially meant that the player needed to always have the Laser equipped for things to be able to function, which doesn't exactly jive with my plans. What I want is to make any weapon or defensive system swappable - you can carry only a shield (if you want to never win a round...) or carry nothing at all. You can carry both a laser and missile barrage, but no shield. You can do anything.
To support this, I abstracted out each weapon to be an Upgrade, then built an upgrade manager (UpgradeMgr) class. Now, in order to give the player certain upgrades, at the start of a level the code can execute:
the.upgrade_list = {'laser','shield','regen'}
Before the player class is instantiated, or
the.ship.upgrades:initialize('laser')
at any point after the ship has been created. The string names correspond to keys in a table in the UpgradeMgr class that simply maps a user friendly name to a class
shield = Upgrade.Shield,
laser = Upgrade.Laser,
health1 = Upgrade.Health,
Now, if any other part of the code needs to check that the player's ship has the laser, or is firing the laser, they can call
-- get the weapon, or nil
the.ship:getWeapon('laser')
the.ship:isFiring('laser')
So that's pretty much what has been going on over the past days. Here's my list of upcoming goals:
- A few more player upgrades
- Get an upgrade menu working so that the user can select upgrade combinations
- Get an upgrade tree/locking system put together, and figure out how upgrade purchasing will work (does the player get bonus points for time/efficiency when beating levels? what exactly can you do to get upgrades quicker?)
- Put together a few levels using various mixtures of enemy numbers/types/other conditions