Sign in to follow this  
  • entries
  • comments
  • views

Plans II

Sign in to follow this  


So this is the plan I have at the moment. I have a series of GameStates: Introduction, TitleScreen, HighScoreScreen, LevelStart, LevelPlay, LevelEnd and GameOver.

In the Introduction GameState a series of screens show up one after another (this will give a story, if any).

Pressing enter at any time will go to TitleScreen.

In the private section of the class there will be an array of Frames (see below) (ie [frame1][frame2]...[frame n]) and 3 x Surface Pointers (currentFrame, nextFrame, screen).

Logic() will see if the delay time (in the Frame class) has expired and then change currentFrame and nextFrame

Render() will just draw the currentFrame

class Frame:
The Frame class will have a surface pointer to the image and a delay time that will indicate how long the frame should be shown.

The TitleScreen will work the same as in Breakout. There will be three options (Play, High Score, Quit).

In the provate section there will be 3 x Surface Pointers (screen, background, arrrow), int choice (0=Play, 1=High Score, 2=Quit) (start at 0) and int nextChoice (starts at 0 too)

Input: Up - go up a choice (nextChoice = choice - 1), Down - go down a choice (nextChoice = choice + 1), Enter - Select choice

Logic() will check to see if nextChoice is a valid number (yes: choice = nextChoice, no: nextChoice = choice)

Render() will draw the background and draw the arrow at choice

class Score
This will contatin a char[3] for the player's intials and an unsigned int for their score

class HighScores
(I think) there will be one global instance of this.

In the private section there will be of 5 Scores.

The functions required for this class will be to load scores from file (put this in the constructor?), write scores to file, print scores, add a score (sort here maybe?), sort scores, check a score is high enough

In the private section this will have 2 x Surface pointers (screen, background).
-Calls to HighScores: print scores
-Input: Enter - Return to title screen

GameState GameOver
-private: 2 x Surface pointers (screen, background)
-Print player's own score
-Calls to HighScores: check a score is high enough - if yes: ask for initials, receive initials, add score
-Input: Enter - Return to title screen

GameState LevelStart
-Render: Draw Background(scrolling), Draw Player, Draw 'LEVEL #'
-Logic: Delay then go to LevelPlay

GameState LevelEnd
-Render: Draw 'LEVEL # COMPLETE', show how many of each enemy destroyed, total up the score, show, current hit %
GameState LevelPlay
-Input: Left/Right - move player left/right
Space - fire weapon
-Logic: Move enemies, collision detection, move background
-Render: Draw score, lives, player, enemies, background

class Ship
-private: image, health, Bullet
-functions: Move(destX, destY), FireWeapon(), Draw()

(Player and Enemy inherit from this)

class Bullet
-private: image, strength
-functions: Draw(), Move()

Collision Detection
-Takes a Bullet and a Ship class and sees if they have collided

class Player
-Extra stuff: hit%, score, enemies destroyed

class Enemy
-Extra stuff: Movement Pattern, state

MovementPatterns - a list of (x, y) coords to follow for different paths (eg, straight line, loop etc)
EnemyState - Entering/Leaving, firing, stationary (small movement around a central point), charging (follow player)

class Boss
-Extra stuff: Weak Points (essentially Enemies for collision detection purposes)
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now