Link to my sketch: http://ift.tt/2a4VzzB
void check(ship s){
float d = dist(s.getX(),s.getY(),this.posx,this.posy);
if (d <= this.radius){
s.setSpeed(0.5);
}
if (d > this.radius){
s.setSpeed(2);
}
}
When i delete the second if-statement, the ship reduces its speed but don't accelerate when the distance is greater than the obstacle's radius.
Something's wrong with the set-method?
Aucun commentaire:
Enregistrer un commentaire