v7
Diff: Robot.cpp
- Revision:
- 9:aff70d8f388a
- Parent:
- 8:9d0e8da27044
- Child:
- 10:d88127a08e44
diff -r 9d0e8da27044 -r aff70d8f388a Robot.cpp --- a/Robot.cpp Sat Mar 18 15:07:10 2017 +0000 +++ b/Robot.cpp Thu Mar 23 09:46:24 2017 +0000 @@ -37,34 +37,42 @@ return pattern; } - void Robot::action(char idAction){ - + void Robot::action(char idAction,char mode){ + int temps; + + if(mode=='a'){ + temps = 0.1; + } + else{ + temps = 2; + } + switch(idAction){ // deplacement simple case 'a' : { if(obstacle==false){ - this->deplacement.avancer(); + this->deplacement.avancer(temps); break; } } case 'b' : { - this->deplacement.droite(); + this->deplacement.droite(temps); break; } case 'c' : { - this->deplacement.reculer(); + this->deplacement.reculer(temps); break; } case 'd' : { - this->deplacement.gauche(); + this->deplacement.gauche(temps); break; }