This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Klasa Ice
Antek Bizon edited this page Mar 5, 2022
·
1 revision
Odpowiada za lód. Jego tekstura wyświetlana jest w rzeczywistości lekko poniżej faktycznych rozmiarów obiektu dla poprawnej detekcji kolizji z Player’em.
class Ice : public Sprite {
public:
Ice(Game* game, float x, float y, float width, float height);
Ice(Game* game, std::ifstream&);
virtual void Draw();
virtual void Save(std::ofstream&);
private:
Texture2D* texture;
Rectangle textRec;
};
Ice::Ice(Game *game, float x, float y, float width, float height)
: Sprite(game, Position(x, y, width, height), Type::ICE) {
texture = &game->textures[ICE];
}
Ice::Ice(Game *game, std::ifstream& s)
: Sprite(game, s, Type::ICE) {
texture = &game->textures[ICE];
}
void Ice::Draw() {
DrawTextureTiled(*texture, { 0, 0, 15, 30 }, position.rectangle, { 0, -7 }, 0, 1, WHITE);
}
void Ice::Save(std::ofstream& s) {
Write(s, &type);
position.Save(s);
}