Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Tank::Update()
- {
- if (currentPathIndex > 0 && currentPathIndex == path.size())
- {
- path.clear();
- currentPathIndex = 0;
- searching = false;
- }
- if (path.size() > 0)
- {
- sf::Vector2i direction;
- sf::Vector2f dirNorm;
- direction = (sf::Vector2i)path[currentPathIndex].GetPosition() - (sf::Vector2i)position;
- dirNorm = normalize((sf::Vector2f)direction);
- if (direction == sf::Vector2i(0,0))
- {
- currentPathIndex++;
- }
- move((sf::Vector2f)dirNorm);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement