Skip to content
Snippets Groups Projects
Commit fbdb5f07 authored by sgupta72's avatar sgupta72
Browse files

Working

parent 50fec9e2
No related branches found
No related tags found
No related merge requests found
......@@ -2,15 +2,20 @@
#define GAME_H
#include <SDL2/SDL.h>
/**
* Main game class that contains game loop
**/
class Game
{
public:
Game();
~Game();
//main game loop
void GameLoop();
private:
//has the user quit?
bool quit;
//current event
SDL_Event e;
};
#endif
......@@ -14,19 +14,65 @@ class Window;
class Rect
{
public:
/**
* load spritesheet
* filename: filaname of image file
* window: window to draw on
**/
Rect(string filename, Window &window);
//load spritesheet
/**
* load spritesheet
* filename: filaname of image file
* window: window to draw on
* rows: rows in spritesheet
* column: columns in spritesheet
**/
Rect(string filename, Window &window, int rows, int columns);
~Rect();
/**
* move rect to x, y coordinate
**/
void Move(int x, int y);
/**
* add velocity to movement
**/
void AddVelocity(int vx, int vy);
/**
* update position of rect
**/
void UpdatePosition();
/**
* draw the image
* window: window to draw on
**/
void Draw(Window &window);
/**
* render part of spritesheet on window
* window: window to draw on
* row: row of spritesheet
* column: column of spritesheet
**/
void Draw(Window &window, int row, int column);
/**
* check collision with rect
* rect: rectangle ot check against
**/
bool CheckCollision(Rect &rect);
/**
* move back if colliding with rect in rects
* rects: rect vector to check against
**/
void CorrectPosition(vector<Rect*> rects);
/**
* get image surface
**/
SDL_Surface *get_image();
private:
/**
* actually load image
* filename: file to load from
* window: window to draw on
*/
void LoadImage(string filename, Window &window);
SDL_Surface *image;
int x, y;
......
rubric 0 → 100644
Main game logic.
Player movement:
Player should be able to move around and jump.
Enemy spawning and movement:
Enemy should spawn and move around automatically.
Enemy Killing and respawning
Should be able to kill enemy. Enemy should respawn after killing.
Animation:
Player and enemy should be animated.
......@@ -11,7 +11,9 @@ class Window
public:
Window();
~Window();
//get screen surface to draw on, etc.
SDL_Surface *get_screen_surface();
//update window
void Update();
private:
SDL_Window *window;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment