Hello,
I try write the smiple board game. Now i try write the function for move my pawn but i have Big problem:< I try do this on pos().x().y() with condition if else. And a i don't have idea how i can move my pawn on the left wall game. My pawn correct go to right next to down next to left but next he returned or stoped :< coud you help me?

Qt Code:
  1. void Gracz::ruch()
  2. {
  3.  
  4. int wynik= 10;
  5.  
  6. for(int i =0; wynik>i; i++ )
  7. { //droga w prawo
  8.  
  9. if(pos().x() < 1300 && pos().y() <500 ) //warunek dla gory
  10. setPos(x()+10,y());
  11.  
  12. else if((pos().x() > 1290 && pos().y() <500)) //warunek prawa strona
  13. {
  14. setPos(x(),y()+10);
  15. }
  16. else if ((pos().x() > 0 )) //warunek dol
  17.  
  18. {
  19. setPos(x()-10,y());
  20.  
  21. }
  22. else if( pos().x()==0) //warunek lewa strona
  23. {
  24.  
  25. setPos(x(),y()-10);
  26. }
  27.  
  28.  
  29. }
  30.  
  31. }
To copy to clipboard, switch view to plain text mode