DemoProductions / shmup

3 stars 2 forks source link

Mass update of sprites and related code #146

Closed flip40 closed 7 years ago

flip40 commented 7 years ago

I figure you still don't have time for reviews Adrian, and this changes enough things that I'll pull it shortly. However there are a number of interesting additions here that I'll note should you want to look into them later.

In general, this add in all of the sprites given to us by Tyler except asteroids. It also adds in necessary code and classes to implement them where necessary.

Additions

Notable code changes

Power Ups

Split into 3 classes (not including children):

  1. DropPowerUp.cs, which manages drop rates as well as drop types (could use improvements for drop chancer per item, currently it is total drop chance and random item selection). This drops a PickUp object.
  2. PickUp.cs, which handles the mechanics of a player picking up the item and then adding the appropriate PowerUp. Takes a PowerUp variable, which should be a GameObject with a PowerUp script. This script also handles what happens when you pick up multiple of the same type of Power Up.
  3. PowerUp.cs (Shield.cs and Damage.cs inherit), which handles the actual Power Up on the player. PowerUp contains abstract functions Setup() and RemovePowerUp() which handle the start and finish of the Power Up.

Explosions!

Explosion.cs pretty simply let's its animation run then destroys itself. The explosion is set off / instantiated by Health.cs currently. It also now takes anexplosionEffect GameObject so one can change the explosion. It also scales itself to the scale of the parent object (this might need changing at some point, but good for now).

Simple Animator

Seen in Explosion.cs, and just about everywhere else now. Much nicer handling for animation than Unity's animation editor if you ask me. Simply lock the Inspector window, drag a selection of sprites onto an empty Frames list (script variable) and set the FPS and choose whether or not it loops. Not my own script, though the implementation is pretty simple.

LevelController