Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void AIEnemy::AutoMotion(Gridspot& grid)
- {
- std::pair<int, int> ecn = getNodePosition();
- sf::Time deltaTime = clock.getElapsedTime();
- std::reverse(grid.Path.begin(), grid.Path.end());
- for (auto path : grid.Path)
- {
- float rectx = rect.getPosition().x + rect.getOrigin().x / 2,
- `recty = rect.getPosition().y + rect.getOrigin().y / 2;`
- bool firm= true;
- if (ecn.first == path.node.first && top >= path.rectCenter.y)
- {
- rect.move(0, -2);
- }
- if (ecn.second == path.node.second && left >= path.rectCenter.x)
- {
- rect.move(-2 , 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement