Advertisement
thecplusplusguy

Simple sidescroller game - bullet.h

Jul 14th, 2011
1,961
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 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 bullet.h a class for a bullet
  6. #include <SDL/SDL.h>    //for SDL
  7. #include <iostream>     //if we want to write out something, probobly it can be deleted if you don't want
  8.  
  9. #ifndef BULLET_H    //avoid multiple indclusion
  10. #define BULLET_H
  11.  
  12. class bullet{
  13.     SDL_Rect box;   //bounding box (for the blitting and for the collision detection)
  14.     int xvel,yvel;  //the velocity (speed)
  15.     SDL_Surface* image; //the image of the bullet
  16.     public:
  17.     bullet(SDL_Surface* img,int x,int y,int xvel,int yvel); //constructor
  18.     //obvious
  19.     void move();
  20.     void show(SDL_Surface* screen);
  21.     SDL_Rect* getRect();
  22. };
  23.  
  24. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement