Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Node
- {
- std::pair <int, int> node;
- bool iswall = false;
- };
- void Gridspot::setEnemyPosition(int i, int j)
- {
- Enemytank.node = std::make_pair(i,j);
- }
- class AIEnemy
- {
- public:
- AIEnemy()
- void Update();
- sf::RectangleShape getRect();
- void setNodePosition(sf::RectangleShape * pos);
- void AutoMotion(int col, int row);
- };
- AIEnemy::AIEnemy()
- {
- ect.setSize(sf::Vector2f(25.f, 25.f));
- sf::Vector2f origin = rect.getSize();
- rect.setOrigin(sf::Vector2f(origin.x /2 , origin.y / 2));
- rect.setFillColor(sf::Color::Blue);
- }
- void AIEnemy::setNodePosition(sf::RectangleShape * pos)
- {
- sf::Vector2f origin = pos->getSize();
- rect.setPosition(pos->getPosition().x+ origin.x /2, pos->getPosition().y + origin.y / 2);
- }
- if (i == pAInode.first && j == pAInode.second)
- {
- AItank.setNodePosition(&box[i][j]);
- }
- void AIEnemy::Update()
- {
- bottom = rect.getPosition().y + rect.getSize().y;
- left = rect.getPosition().x;
- right = rect.getPosition().x + rect.getSize().x;
- top = rect.getPosition().y;
- }
Add Comment
Please, Sign In to add comment