Peoplemon  0.1.0
Peoplemon 3 game source documentation
Tile.cpp
Go to the documentation of this file.
1 #include <Core/Maps/Tile.hpp>
2 #include <Core/Maps/Tileset.hpp>
3 
4 #include <iostream>
5 
6 namespace core
7 {
8 namespace map
9 {
11 : isAnim(false)
12 , tid(Blank) {}
13 
14 Tile::Tile(IdType i, bool a)
15 : Tile() {
16  tid = i;
17  isAnim = a;
18 }
19 
20 bool Tile::isAnimation() const { return isAnim; }
21 
22 Tile::IdType Tile::id() const { return tid; }
23 
24 void Tile::set(IdType id, bool anim) {
25  tid = id;
26  isAnim = anim;
27 }
28 
29 void Tile::step() {
30  switch (renderObject.index()) {
31  case 2:
32  std::get_if<bl::gfx::BatchSlideshowSimple>(&renderObject)->getPlayer().play();
33  break;
34  case 3:
35  (*std::get_if<std::shared_ptr<bl::gfx::Animation2D>>(&renderObject))->getPlayer().play();
36  break;
37  }
38 }
39 
40 } // namespace map
41 } // namespace core
Core classes and functionality for both the editor and game.
Data representation of a tile in a Map TileLayer.
Definition: Tile.hpp:30
void step()
Triggers the animation when the tile is stepped on.
Definition: Tile.cpp:29
IdType id() const
Returns the id of the image or animation of this tile.
Definition: Tile.cpp:22
std::uint16_t IdType
Definition: Tile.hpp:33
Tile()
Makes a blank tile.
Definition: Tile.cpp:10
bool isAnimation() const
Returns whether this tile is an animation or not.
Definition: Tile.cpp:20
void set(IdType id, bool anim)
Sets the information of the tile.
Definition: Tile.cpp:24