Advertisement
Guest User

Spell.cpp

a guest
Jun 2nd, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. #include "Spell.h"
  2.  
  3.  
  4.  
  5. Spell::Spell()
  6. {
  7. }
  8.  
  9.  
  10. void Spell::LoadContent(/*Characters *wizard*/)
  11. {
  12.     if (!this->m_texture.loadFromFile("res/graphics/" + this->m_path))
  13.         std::cout << "ERROR LOADING SPELL" << std::endl;
  14.     /*if (m_direction == Direction::UP)
  15.     {
  16.         this->m_position.x = 0;
  17.         this->m_position.y = wizard->getPosition().y;
  18.     }
  19.     else if (m_direction == Direction::DOWN)
  20.     {
  21.         this->m_position.x = 0;
  22.         this->m_position.y = wizard->getPosition().y;
  23.     }
  24.     else if(m_direction == Direction::RIGHT)
  25.     {
  26.         this->m_position.x = wizard->getPosition().x;
  27.         this->m_position.y = 0;
  28.     }
  29.     else if (m_direction == Direction::RIGHT)
  30.     {
  31.         this->m_position.x = wizard->getPosition().x;
  32.         this->m_position.y = 0;
  33.     }*/
  34.     this->m_position.x = 100;
  35.     this->m_position.y = 100;
  36.     this->m_sprite.setTexture(this->m_texture);
  37.     this->m_sprite.setPosition(this->m_position);
  38.     this->m_sprite.setOrigin(this->m_texture.getSize().x, this->m_texture.getSize().y);
  39.     this->m_sprite.setColor(sf::Color::Red);
  40. }
  41.  
  42. void Spell::Update()
  43. {
  44.     if (m_direction == Direction::UP)
  45.         this->m_sprite.move(0, SPEED);
  46.     else if (m_direction == Direction::DOWN)
  47.         this->m_sprite.move(0, -SPEED);
  48.     else if (m_direction == Direction::RIGHT)
  49.         this->m_sprite.move(SPEED, 0);
  50.     else if (m_direction == Direction::LEFT)
  51.         this->m_sprite.move(-SPEED, 0);
  52.  
  53. }
  54.  
  55. void Spell::Draw(sf::RenderWindow &window)
  56. {
  57.     window.draw(m_sprite);
  58. }
  59.  
  60.  
  61. Spell::~Spell()
  62. {
  63. }
  64.  
  65. Fire::Fire()
  66. {
  67. }
  68.  
  69. Fire::Fire(Direction direction)
  70. {
  71.     this->m_path = "spell_fire.png";
  72.     this->m_direction = direction;
  73. }
  74.  
  75. Fire::~Fire()
  76. {
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement