Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This example program is created by thecplusplusuy for demonstration purposes. It's a simple mario like side-scroller game:
- //http://www.youtube.com/user/thecplusplusguy
- //Free source, modify if you want, LGPL licence (I guess), I would be happy, if you would not delete the link
- //so other people can see the tutorial
- //this file is base.h a base class for some other file
- #include <SDL/SDL.h> //include SDL/SDL.h
- #ifndef BASE_H //avoid multiple inclusion
- #define BASE_H
- class baseclass{
- protected:
- 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
- //many file need this, so I make it into here
- public:
- static SDL_Rect coord; //coord variable, store the absolute coordinate of the screen, so if I go a 1000px it will be a 1000px
- //actual memory will be reserved in the game.cpp
- 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
- //initialize it here
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment