added player2 gfx

This commit is contained in:
2021-08-22 09:41:17 +02:00
parent 837306f16e
commit e793e08e85
11 changed files with 40 additions and 9 deletions

View File

@@ -5,14 +5,12 @@
Item::Item()
{
mSprite = new AnimatedSprite();
//init(NO_KIND, 0, 0, nullptr, nullptr);
mClass = NO_KIND;
}
// Destructor
Item::~Item()
{
//init(NO_KIND, 0, 0, nullptr, nullptr);
delete mSprite;
mSprite = nullptr;
}
@@ -82,6 +80,22 @@ void Item::init(Uint8 value, float x, float y, LTexture *texture, SDL_Renderer *
mSprite->setAnimationFrames(0, 1, 16 * 5, 16 * 1, mWidth, mHeight);
break;
case ITEM_COFFEE_MACHINE:
mWidth = 32;
mHeight = 32;
mPosX = (rand() % (PLAY_AREA_WIDTH - mWidth - 3)) + 3;
mPosY = PLAY_AREA_TOP - mHeight;
mVelX = 0.0f;
mVelY = -2.0f;
mSprite->setAnimationNumFrames(0, 4);
mSprite->setAnimationFrames(0, 0, 32 * 0, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 1, 32 * 1, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 2, 32 * 2, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 3, 32 * 3, 16 * 2, mWidth, mHeight);
mCollider.r = mWidth / 2;
shiftColliders();
break;
default:
break;
}