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 enemy.h a class for the enemies
- #include <SDL/SDL.h> //for SDL
- #include <vector> //we need it for the map
- #include "base.h"
- #ifndef ENEMY_H //avoid multiple inclusion
- #define ENEMY_H
- class enemy:public baseclass{ //we inherit from baseclass because the collision function
- SDL_Rect box; //collision box (bounding box)
- int xvel,yvel; //velocity (speed)
- SDL_Surface* image; //image
- bool ground; //are we on the ground?
- SDL_Rect clips[2]; //clips for the animation in enemy.bmp picture
- double frame; //the current frame
- public:
- //obvious
- enemy(SDL_Surface*,int x,int y,int xvel,int yvel);
- void move(std::vector<std::vector<int> >&);
- void show(SDL_Surface*);
- SDL_Rect* getRect();
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment