Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
Explosion.h
Go to the documentation of this file.
1#pragma once
2
3#include "KatanaEngine.h"
4
5using namespace KatanaEngine;
6
9{
10
11public:
12
14 virtual ~Explosion() { }
17 virtual void Update(const GameTime& gameTime);
18
21 virtual void Draw(SpriteBatch& spriteBatch);
22
25 virtual void SetAnimation(Animation* pAnimation) { m_pAnimation = pAnimation; }
26
30 virtual void Activate(const Vector2 position, const float scale = 1);
31
34 virtual bool IsActive() const { return m_pAnimation->IsPlaying(); }
35
38 virtual void SetSound(AudioSample* pSound) { m_pSound = pSound; }
39
42 virtual AudioSample* GetSound() { return m_pSound; }
43
44
45protected:
46
49 virtual void SetPosition(const Vector2 position) { m_position = position; }
50
51
52private:
53
54 Animation* m_pAnimation = nullptr;
55 AudioSample* m_pSound = nullptr;
56
57 Vector2 m_position;
58
59 float m_rotation = 0;
60 float m_scale = 1;
61
62};
Represents an explosion animation in the game.
Definition Explosion.h:9
virtual void SetPosition(const Vector2 position)
Sets the explosion's position.
Definition Explosion.h:49
virtual AudioSample * GetSound()
Get the sound that will be played when the explosion is activated.
Definition Explosion.h:42
virtual void Draw(SpriteBatch &spriteBatch)
Render the explosion.
Definition Explosion.cpp:9
virtual void SetAnimation(Animation *pAnimation)
Sets the explosion's animation.
Definition Explosion.h:25
virtual void SetSound(AudioSample *pSound)
Set the sound that will be played when the explosion is activated.
Definition Explosion.h:38
virtual bool IsActive() const
Checks if the explosion is active.
Definition Explosion.h:34
virtual void Update(const GameTime &gameTime)
Update the explosion.
Definition Explosion.cpp:3
virtual void Activate(const Vector2 position, const float scale=1)
Activates the explosion.
Definition Explosion.cpp:19
virtual ~Explosion()
Definition Explosion.h:14
Represents timing and framing values for texture animations.
Definition Animation.h:21
virtual bool IsPlaying() const
Determines if the animation is playing.
Definition Animation.h:76
Represents a 2D grid of texels.
Definition AudioSample.h:21
Contains timing values for game updates and rendering.
Definition GameTime.h:21
Enables a group of sprites to be drawn using the same settings.
Definition SpriteBatch.h:48
Defines a vector with 2 components (x and y).
Definition Vector2.h:21
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition Animation.cpp:18