Difference between revisions of "2D Space Shooter Part 1: Planning, Tooling, Layers, Objects"

From GiderosMobile
Line 40: Line 40:
  
 
Okay, sounds like a plan, no ? Enough thinking now, let's begin.
 
Okay, sounds like a plan, no ? Enough thinking now, let's begin.
 +
 +
[[2D Space Shooter Part 2: Background]]

Revision as of 09:07, 2 January 2020

Planning

Alright, I understand you want to get started quickly, and I would too if I were you. However I felt like writing a few lines about project planning here. Whatever you want to build, you need to prepare a plan before. It doesn't need to be detailed, nor even written, but having thought of what you want to achieve before writing the first line code of code will make you save time.

Here are my thoughts about that 2D Space Shooter I am gonna write with you:

  • There will be a medium sized ship for the player at the bottom of the screen
  • I am assuming it will be played in portrait mode on a phone
  • Since it is on phone, the ship will follow the finger of the player
  • It will fire when the phone is touched, and stop firing when the finger is lifted
  • Enemies will arrive from the top of screen
  • They will come in waves
  • Each ship (even the player) will have a fixed number of 'armour' points
  • Armour points will decrease each time a missile/fire hits a ship
  • Ships with 0 armour points explode
  • Enemies will drop 'power ups' when they explode, and the player will be able to pick them
  • Power ups will be things like armour booster, improved fire power, ...

Those were just thoughts as they came to me, the game isn't written yet, but we already have to answer more questions:

  • How will we handle ship/ship bullet/ship collisions ?

Since we don't need physics, we will use bump collision engine, or rather its native version, cbump.

  • How will we design our levels or ship waves ?

I was thinking of using Tiled map editor at first, but on second thought a simple 'ASCII art' style string will be easier and more effective.

Layers

Now how that maps to Gideros ? We will probably end up with five Sprite layers on stage:

  • A starry background
  • Enemies ships
  • Player ship (let it be always shown on top the enemies)
  • A Sprite layer for all the bullets and missiles
  • And finally on top on of everything a layer to display texts such as score

Objects

We will use OOP (Object Oriented Programming) to structure our code, that is our game functions will be (as much as possible) organized in classes and objects. With what we have in mind, some object classes already appear:

  • Ship: will be used to represent a space ship, player or enemy, with its amour points
  • EnemyShip: will be a subclass of Ship, and hold the characteristics of a specific enemy ship, like the way it moves, its firing style, etc.
  • PlayerShip: the player specific subclass of Ship. It will handle the player firing style, power ups collecting, and touch-based control
  • Bullet: a missile/fire/bullet, it will progress on screen, detect collisions, and eventually explode
  • Powerup: a class holding the possible power-ups

Okay, sounds like a plan, no ? Enough thinking now, let's begin.

2D Space Shooter Part 2: Background