The NEW Pong Game  V13.2.1
An interesting implemnettaion of the pong game
invisible_power.hpp
Go to the documentation of this file.
1 
8 #ifndef INVISIBLE_POWER_HPP
9 #define INVISIBLE_POWER_HPP
10 #include <SDL.h>
11 #include <SDL_ttf.h>
12 #include <cstdlib>
13 #include <ctime>
14 #include <cmath>
15 
16 #include "ball_base.hpp"
17 #include "power.hpp"
18 
26 class InvisiblePower : public Power
27 {
28 public:
34  InvisiblePower(int screen_width, int screen_height);
35 
43  void update(float time, BallBase *Ball, SDL_Renderer *renderer); // no need for override becase the declaration is completly different (do not share the same arguments structure)
44 
49  void render(SDL_Renderer *renderer) override;
50 
55  void reset(int screen_width) override;
56 
61  void set_initialisation(bool init) { initialisation = init; }
62 
63 private:
64  float repeat;
66 };
67 
68 #endif
Base class for all ball types in the game.
SDL_Renderer * renderer
Definition: ball_test.cpp:25
Abstract base class for all ball types in the game.
Definition: ball_base.hpp:23
Power-up that makes the ball temporarily invisible.
Definition: invisible_power.hpp:27
float repeat
Definition: invisible_power.hpp:64
void reset(int screen_width) override
Resets the power to a new random position.
Definition: invisible_power.cpp:171
InvisiblePower(int screen_width, int screen_height)
Constructor for the InvisiblePower class.
Definition: invisible_power.cpp:22
void set_initialisation(bool init)
Sets the initialization flag.
Definition: invisible_power.hpp:61
bool initialisation
Definition: invisible_power.hpp:65
void update(float time, BallBase *Ball, SDL_Renderer *renderer)
Updates the power's position and the ball's visibility.
Definition: invisible_power.cpp:39
void render(SDL_Renderer *renderer) override
Renders the power as a star on screen.
Definition: invisible_power.cpp:107
Class representing power-up items that affect gameplay.
Definition: power.hpp:27
Header defining the Power class for special game effects.