thecplusplusguy

Simple sidescroller game - base.h

Jul 14th, 2011
3,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. //This example program is created by thecplusplusuy for demonstration purposes. It's a simple mario like side-scroller game:
  2. //http://www.youtube.com/user/thecplusplusguy
  3. //Free source, modify if you want, LGPL licence (I guess), I would be happy, if you would not delete the link
  4. //so other people can see the tutorial
  5. //this file is base.h a base class for some other file
  6.  
  7.  
  8. #include <SDL/SDL.h>    //include SDL/SDL.h
  9. #ifndef BASE_H  //avoid multiple inclusion
  10. #define BASE_H
  11.  
  12. class baseclass{
  13.     protected:
  14.         bool collision(SDL_Rect* rec1,SDL_Rect* rec2);  //make the collision function, it'll return true if there was a collision between rec1 and rec2
  15.                                                                                                       //many file need this, so I make it into here
  16.     public:
  17.     static SDL_Rect coord;  //coord variable, store the absolute coordinate of the screen, so if I go a 1000px it will be a 1000px
  18.     //actual memory will be reserved in the game.cpp
  19.     static const int TILE_SIZE=50;  //store the TILE_SIZE variable, in this case it's 50x50 tiles, it's a static const int, so you can
  20.     //initialize it here
  21. };
  22. #endif
Advertisement
Add Comment
Please, Sign In to add comment