-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeam.cpp
More file actions
53 lines (44 loc) · 1.24 KB
/
Team.cpp
File metadata and controls
53 lines (44 loc) · 1.24 KB
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
#include "Team.h"
#include <iostream>
Team::Team(std::vector<Player*> &myplayers)
{
this->players = myplayers;
}
Team::~Team()
{
//dtor
}
void Team::print_info()
{
std::cout << "n players " << this->players.size() << std::endl;
for (auto it = this->players.begin(); it != this->players.end(); ++it)
{
std::cout << (*it)->position[0] << " " << (*it)->position[1] << std::endl;
std::cout << (*it) << std::endl;
std::cout << (*it)->shape << std::endl;
}
}
void Team::update_player_shape_positions()
{
// Draw them on the window
for (auto it = this->players.begin(); it != this->players.end(); ++it)
(*it)->update_shape();
}
void Team::move_players()
{
// std::array<int, 2> translation;
std::array<float, 2> translation;
for (auto it = this->players.begin(); it != this->players.end(); ++it)
{
// translation = {(*it)->speed, 0};
translation = {3.1,0.1};
(*it)->move(translation);
// std::cout<<(*it)->position[0]<<" "<<(*it)->position[1]<<std::endl;
}
}
void Team::draw_players(sf::RenderWindow &w)
{
// Draw them on the window - understand syntax one day....??
for (auto it = this->players.begin(); it != this->players.end(); ++it)
(*it)->display_shape(w);
}