pub fn fly(&mut self, path: &PlanePath) {
        for turn in path.turns().iter() {
            if turn.touching(&self.rect) {
                match turn.direction() {
                    Direction::Up => {
                        self.dx = 0.0;
                        self.dy = -self.speed;
                        self.rotation = PI * 1.5;
                    }
                    Direction::Down => {
                        self.dx = 0.0;
                        self.dy = self.speed;
                        self.rotation = PI * 0.5;
                    }
                    Direction::Left => {
                        self.dx = -self.speed;
                        self.rotation = PI;
                        self.dy = 0.0;
                    }
                    Direction::Right => {
                        self.dx = self.speed;
                        self.rotation = 0.0;
                        self.dy = 0.0;
                    }
                }
            }
        }
        self.rect
            .set_pos(self.rect.x() + self.dx, self.rect.y() + self.dy);
    }
/// Advance the location of the Plane by one increment
Advance the location of the Plane by one increment
Advance the location of the Plane by one increment
pub fn fly(&mut self, path: &PlanePath) {
        for turn in path.turns().iter() {
            if turn.touching(&self.rect) {
                match turn.direction() {
                    Direction::Up => {
                        self.dx = 0.0;
                        self.dy = -self.speed;
                        self.rotation = PI * 1.5;
                    }
                    Direction::Down => {
                        self.dx = 0.0;
                        self.dy = self.speed;
                        self.rotation = PI * 0.5;
                    }
                    Direction::Left => {
                        self.dx = -self.speed;
                        self.rotation = PI;
                        self.dy = 0.0;
                    }
                    Direction::Right => {
                        self.dx = self.speed;
                        self.rotation = 0.0;
                        self.dy = 0.0;
                    }
                }
            }
        }
        self.rect
            .set_pos(self.rect.x() + self.dx, self.rect.y() + self.dy);
    }
pub fn fly ( & mut self , path : & PlanePath ) { for turn in path . turns ( ) . iter ( ) { if turn . touching ( & self . rect ) { match turn . direction ( ) { Direction :: Up => { self . dx = 0.0 ; self . dy = - self . speed ; self . rotation = PI * 1.5 ; } Direction :: Down => { self . dx = 0.0 ; self . dy = self . speed ; self . rotation = PI * 0.5 ; } Direction :: Left => { self . dx = - self . speed ; self . rotation = PI ; self . dy = 0.0 ; } Direction :: Right => { self . dx = self . speed ; self . rotation = 0.0 ; self . dy = 0.0 ; } } } } self . rect . set_pos ( self . rect . x ( ) + self . dx , self . rect . y ( ) + self . dy ) ; }
Advance the location of the Plane by one increment
Advance the location of the Plane by one increment
&mut self
path
&PlanePath
&mut self
path
&PlanePath