-
Notifications
You must be signed in to change notification settings - Fork 1
/
GroundMissile.cpp
53 lines (52 loc) · 1.36 KB
/
GroundMissile.cpp
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
43
44
45
46
47
48
49
50
51
52
53
#include"../GroundMissile.h"
#include<SFML/Graphics.hpp>
#include<iostream>
#include<SFML/Graphics.hpp>
#include"../GroundMissile.h"
GroundMissile::GroundMissile()
{
if (!missileText.loadFromFile("resources/groundmissile.png") || !missileBaseText.loadFromFile("resources/missilebase.png"))
{
std::cout << "Couldn't load from file";
}
missileBase.setTexture(missileBaseText);
missileSprite.setTexture(missileText);
missileBase.setPosition(sf::Vector2f(400.0f, 550.0f));
missileSprite.setPosition(sf::Vector2f(400.0f, 550.0f));
}
void GroundMissile::setMissilePosition(sf::Vector2f pos)
{
missileSprite.setPosition(sf::Vector2f(pos.x, pos.y));
}
sf::Vector2f GroundMissile::getMissilePosition()
{
return missileSprite.getPosition();
}
void GroundMissile::setBasePosition(sf::Vector2f pos)
{
missileBase.setPosition(sf::Vector2f(pos.x, pos.y));
}
void GroundMissile::setMissileRotation(float angle)
{
missileSprite.setRotation(angle*180.0f/3.14f);
}
sf::Vector2f GroundMissile::getBasePosition()
{
return missileBase.getPosition();
}
void GroundMissile::moveMissile(sf::Vector2f off)
{
missileSprite.move(sf::Vector2f(off.x, off.y));
}
void GroundMissile::drawMissile(sf::RenderWindow& window)
{
window.draw(missileSprite);
}
void GroundMissile::drawBase(sf::RenderWindow& window)
{
window.draw(missileBase);
}
sf::Sprite* GroundMissile::getBaseAddress()
{
return &missileBase;
}