-
Notifications
You must be signed in to change notification settings - Fork 1
/
Wagon.hpp
42 lines (34 loc) · 924 Bytes
/
Wagon.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <Thor/Particles/ParticleSystem.hpp>
#include <Thor/Particles/Emitters.hpp>
#include <SFML/Graphics/Texture.hpp>
class Tracks;
class Wagon : public sf::Drawable
{
public:
enum class State{
OnTrack,
OnAir
};
Wagon(const Tracks& track);
void jump();
void rocket();
void toggleArrow();
const sf::Vector2f& getPosition() const;
void update(const sf::Time &time);
private:
void draw(sf::RenderTarget &target, sf::RenderStates states) const override;
void applyDragGravity();
sf::RectangleShape m_shape;
const Tracks& m_track;
sf::Vector2f m_velocity;
State m_state;
sf::Texture m_explosion;
thor::ParticleSystem m_particleSystem;
thor::UniversalEmitter m_emitter;
float m_rocketTime;
bool m_rocketOn;
bool m_showArrow;
};