Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "SDL.h"
- #include <cstdlib>
- struct Tile
- {
- int type;
- int clip;
- int min;
- int max;
- int frame;
- Tile( int type ) : type(type)
- {
- //sets the starting and ending clips
- switch ( type )
- {
- //background
- case 0:
- min = 0;
- max = 7;
- clip = (rand() % (max - min)) + min;
- break;
- //ground
- case 1:
- min = 8;
- max = 13;
- clip = (rand() % (max - min)) + min;
- break;
- //toxic
- case 2:
- min = 14;
- max = 17;
- clip = (rand() % (max - min)) + min;
- break;
- //lift
- case 3:
- min = 18;
- max = 25;
- clip = (rand() % (max - min)) + min;
- }
- frame = rand() % 30;
- }
- void update()
- {
- //update the animation
- if ( frame % 30 == 0 )
- {
- clip++;
- if ( clip > max )
- clip = min;
- }
- frame++;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement