Last week we left things like this :
1) Get the basic powerups in & working properly.
2) Start playing with ball spin.
3) Add a switchable method for bat control so I can swap between mouse / keyboard / gamepad easily.
4) Start working on the to do list.
I'm no longer going to list stuff like this in the updates, as what I end up working on usually ends up drastically different to the intended list, for a variety of reasons.
Now I have a "to do" list, I will just update on what I've actually done, crossing stuff off as I go and giving some extra info in these updates.
So this may get a bit lengthy.. Sorry!
The "To Do" List.
looks something like this, in no particular order :
- sfx for powerups, extra life, killing aliens, death explosion, transitions etc
- death animation
- alternate controls (keyboard / joypad) & revise controls
- menu system (keyboard / joystick / mouse / music on-off / credits)
- game over / reset mode when all lives lost
- level loop when last level reached
- ball spin which affects speed / direction & can be imparted by the bat
- player selected ball launch angle
That's just a high level overview, each section has some more detailed notes relating to it, and I've also got a "known bugs" section as well.
So, what's happened in the last week?
...is what's happened. Mostly.
I started out creating a list of what I wanted, categorised by what it affected - and it looks like this.
Grow - increase image scale, increase size of collision object
Shrink - decrease as above
Sticky - allows bat to capture
Level Skip - destroy ball, teleport to next level
Triple - create 2 extra balls, 10 degrees either side of original
Destroyer - turns off ball reflection, ball plows through blocks
Speed Up - increase speed by 25% until max speed
Slow Down - decrease speed by 25% until min speed
Forcefield - add a bouncable forcefield to block the bottom of the screen
Random Score Multipler - (2x,3x,4x,5x)
Random Score Bonus - (100,500,1000,5000)
Then I finished off the graphics I was working on for the powerups, which look like this at the moment :
Still not entirely happy, but they'll do for now.
Coding wise, I added everything needed to create, delete and update the movement of the powerup drops.
When a destroyable block is hit, it has a base chance to "drop" a powerup. If one doesn't drop, that chance increases with every destroyable block hit until 100% chance is reached, or a powerup drops.
Then it generates a random powerup from the list above, adds the relevant image and rolls it down the screen. I'm still not 100% certain if I want to go with totally random drops though, I'm considering tweaking it so the drop chance is based on the category of the drop, with some being weighted more heavily than others.
Anyway, with that done I had to revisit the collisions code. When I rewrote it (a few updates back), I built in the functionality to have multiple categories of object (i.e. block, bat, powerup, aliens etc) - but didn't activate it as both the bat and blocks used the same code as the collisions at that point were all run from the ball updates (as that's the primary moving object). So on this pass I activated that functionality and tweaked things so that each object type has its own category
This now gives me the ability to add additional routines which test between specific categories of object - ie bat & powerup, or exclude categories altogether. Then I added a couple of lines of code which create / update / remove the collision objects for the powerups themselves.
I also added a toggle-able overlay for the collision objects which are colour coded by category. Now I can see what happens to the collision objects in real-time as I playtest.
Which led to an idea - with a minor tweak I should be able to create levels with moveable blocks in them, which could add another interesting layer to the gameplay. Added to the list anyway!
And while I was playing about with the collision code, I juggled some of it around & optimised it - which now allows me to do multiple collision checks at any point, and looks like it's cleared the outstanding "ball stuck in bat" bug as well.
So all that's left on that front is to write the little routine to test between the bat and powerup collision objects - which is a simple AABB (Axis Aligned Bounding Box) check. Then onto adding the actual effects of collecting a powerup...
That wasn't all though - I realised in testing I hadn't tied by level transition effects into my delta timing routine, so I tweaked that as well.
And that's pretty much it for this week.