123456789101112131415161718192021222324252627282930313233 |
- #include "SingleAnnimation.h"
- SingleAnimation::SingleAnimation( float x, float y, float width, float height, Resource *resource )
- : GameObject( NICHTS, (int)x, (int)y, (int)width, (int)height )
- {
- this->resource = resource;
- currentImage = 0;
- nextImage = 0.075;
- texturScale = 1;
- textur = resource->getImage( currentImage );
- }
- SingleAnimation::~SingleAnimation()
- {
- resource->release();
- }
- // gibt 1 zurück wenn die annimation vorbei ist
- bool SingleAnimation::tick( double zeit )
- {
- nextImage -= zeit;
- if( nextImage <= 0 )
- {
- nextImage += 0.075;
- currentImage++;
- if( currentImage >= resource->getImageCount() )
- return 1;
- textur->release();
- textur = resource->getImage( currentImage );
- }
- return 0;
- }
|