mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 21:23:41 +00:00
Readded animations
This commit is contained in:
parent
476d24e930
commit
d7f11e7ebd
@ -64,6 +64,13 @@ void SpriteComponent::init()
|
|||||||
|
|
||||||
void SpriteComponent::update()
|
void SpriteComponent::update()
|
||||||
{
|
{
|
||||||
|
// This code is not compatible for animated tiles
|
||||||
|
if (animated) {
|
||||||
|
srcRect.x = srcRect.w * static_cast<int>((SDL_GetTicks() / speed) % frames);
|
||||||
|
|
||||||
|
srcRect.y = animationIndex * transform->height;
|
||||||
|
}
|
||||||
|
|
||||||
this->destRect.x = this->transform->position.x;
|
this->destRect.x = this->transform->position.x;
|
||||||
this->destRect.y = this->transform->position.y;
|
this->destRect.y = this->transform->position.y;
|
||||||
this->destRect.w = transform->width * transform->scale;
|
this->destRect.w = transform->width * transform->scale;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user