Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void AIEnemy::AutoMotion(Gridspot& grid)
  2.  
  3. {
  4.  
  5. std::pair<int, int> ecn = getNodePosition();
  6.  
  7. sf::Time deltaTime = clock.getElapsedTime();
  8.  
  9. std::reverse(grid.Path.begin(), grid.Path.end());
  10.  
  11. for (auto path : grid.Path)
  12.  
  13. {
  14.  
  15. float rectx = rect.getPosition().x + rect.getOrigin().x / 2,
  16.  
  17. `recty = rect.getPosition().y + rect.getOrigin().y / 2;`
  18. bool firm= true;
  19.  
  20.  
  21.  
  22. if (ecn.first == path.node.first && top >= path.rectCenter.y)
  23.  
  24. {
  25.  
  26. rect.move(0, -2);
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33.  
  34. if (ecn.second == path.node.second && left >= path.rectCenter.x)
  35.  
  36. {
  37.  
  38. rect.move(-2 , 0);
  39.  
  40.  
  41.  
  42. }
  43.  
  44. }
  45.  
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement