class ParticuleAleatoire extends Particule { float randomness = 5; // // Constructeur ParticuleAleatoire (color c, float randomness ) { super ( c ); this.randomness = randomness; } // Animation void animer() { //rebondir x += vx; if ( ( (x<0) && (vx<0) ) || ( (x >= width) && (vx>0) ) ) vx = -vx; y += vy; if ( ( (y<0) && (vy<0) ) || ( (y >= height) && (vy>0) ) ) vy = -vy; // Ajouter une valeur aléatoire à la position x += random ( -randomness, randomness ); y += random ( -randomness, randomness ); } }