deplacement v6

Fork of Deplacement by Projet robot

Committer:
aure
Date:
Thu Feb 02 10:53:40 2017 +0000
Revision:
3:965871a8c5ff
Parent:
2:7e0d789e1be8
Child:
4:bd8b50f91f81
ojiik

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aure 0:d6b2da5ef6cb 1 #include "Deplacement.h"
aure 1:662d3c47637f 2 #include "mbed.h"
aure 0:d6b2da5ef6cb 3
aure 0:d6b2da5ef6cb 4
aure 1:662d3c47637f 5 Deplacement::Deplacement() //constructeur
aure 1:662d3c47637f 6 {
aure 1:662d3c47637f 7 posx=0;
aure 1:662d3c47637f 8 posy=0;
aure 1:662d3c47637f 9 this->vitesse=0; //pointeur this
aure 1:662d3c47637f 10 }
aure 1:662d3c47637f 11
aure 1:662d3c47637f 12 Deplacement::~Deplacement()
aure 0:d6b2da5ef6cb 13 {
aure 0:d6b2da5ef6cb 14
aure 1:662d3c47637f 15 }
aure 1:662d3c47637f 16
aure 1:662d3c47637f 17 /////////////////////////////////////////////////////
aure 1:662d3c47637f 18
aure 1:662d3c47637f 19 void Deplacement::setVitesse(float v)
aure 1:662d3c47637f 20 {
aure 1:662d3c47637f 21 this->vitesse=v;
aure 1:662d3c47637f 22 }
aure 1:662d3c47637f 23
aure 1:662d3c47637f 24 /////////////////////////////////////////////////////
aure 1:662d3c47637f 25
aure 1:662d3c47637f 26 void Deplacement::tourner_droite()
aure 1:662d3c47637f 27 {
aure 2:7e0d789e1be8 28 int copie=0;
aure 1:662d3c47637f 29 m3pi.right(this->vitesse);
aure 2:7e0d789e1be8 30
aure 2:7e0d789e1be8 31 posx=copie;
aure 2:7e0d789e1be8 32 posx=posy;
aure 2:7e0d789e1be8 33 posy=-copie;
aure 2:7e0d789e1be8 34
aure 1:662d3c47637f 35 }
aure 1:662d3c47637f 36
aure 1:662d3c47637f 37 void Deplacement::tourner_gauche()
aure 1:662d3c47637f 38 {
aure 2:7e0d789e1be8 39 int copie=0;
aure 1:662d3c47637f 40 m3pi.left(this->vitesse);
aure 2:7e0d789e1be8 41
aure 2:7e0d789e1be8 42 posx=copie;
aure 2:7e0d789e1be8 43 posx=-posy;
aure 2:7e0d789e1be8 44 posy=copie;
aure 1:662d3c47637f 45 }
aure 1:662d3c47637f 46
aure 1:662d3c47637f 47 void Deplacement::avancer()
aure 1:662d3c47637f 48 {
aure 1:662d3c47637f 49 m3pi.forward(this->vitesse);
aure 2:7e0d789e1be8 50 posy++;
aure 1:662d3c47637f 51 }
aure 1:662d3c47637f 52
aure 1:662d3c47637f 53 void Deplacement::reculer()
aure 1:662d3c47637f 54 {
aure 1:662d3c47637f 55 m3pi.backward(this->vitesse);
aure 2:7e0d789e1be8 56 posy--;
aure 1:662d3c47637f 57 }
aure 1:662d3c47637f 58
aure 3:965871a8c5ff 59 void Deplacement::stop()
aure 3:965871a8c5ff 60 {
aure 3:965871a8c5ff 61 m3pi.stop();
aure 3:965871a8c5ff 62 }
aure 3:965871a8c5ff 63
aure 2:7e0d789e1be8 64 void Deplacement::RAZ()
aure 2:7e0d789e1be8 65 {
aure 2:7e0d789e1be8 66 posx=0;
aure 2:7e0d789e1be8 67 posy=0;
aure 2:7e0d789e1be8 68 this->vitesse=0;
aure 2:7e0d789e1be8 69
aure 2:7e0d789e1be8 70 }
aure 1:662d3c47637f 71
aure 3:965871a8c5ff 72 float Deplacement::getVitesse()
aure 3:965871a8c5ff 73 {return(this->vitesse);
aure 3:965871a8c5ff 74 }
aure 3:965871a8c5ff 75 int Deplacement::getPosX()
aure 3:965871a8c5ff 76 { return(this->posx);
aure 3:965871a8c5ff 77 }
aure 3:965871a8c5ff 78 int Deplacement::getPosY()
aure 3:965871a8c5ff 79 { return(this->posy);
aure 3:965871a8c5ff 80 }
aure 1:662d3c47637f 81
aure 1:662d3c47637f 82
aure 1:662d3c47637f 83
aure 1:662d3c47637f 84
aure 1:662d3c47637f 85