Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. int StudentWorld::move() {
  2.  
  3.  
  4.  
  5. m_ticks++;
  6.  
  7. for(int i = 0; i < m_actors.size(); i++)
  8. m_actors.at(i)->doSomething();
  9.  
  10. // This code is here merely to allow the game to build, run, and terminate after you hit enter.
  11. // Notice that the return value GWSTATUS_NO_WINNER will cause our framework to end the simulation.
  12. if(m_ticks >= 100) // change to 2000 later
  13. return GWSTATUS_PLAYER_WON;
  14. else
  15. return GWSTATUS_CONTINUE_GAME;
  16. }
  17.  
  18. bool StudentWorld::pebbleThere(int x, int y) {
  19. // for(int i = 0; i < m_actors.size(); i++) {
  20. // int iid = m_actors.at(i)->getID();
  21. // if(iid == IID_BABY_GRASSHOPPER)
  22. // return true; // cant use getID() :-(
  23. // }
  24. // return false;
  25. vector<Actor*>::iterator p = m_actors.begin();
  26. while (p != m_actors.end()) {
  27. if((*p)->doesItBlock()) {
  28. if(x == (*p)->getX() && y == (*p)->getY())
  29. return true;
  30. }
  31. p++;
  32. }
  33. return false;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement