pub fn tick(&mut self) {
        // Move the ship
        self.x      += self.vel_x;
        self.y      += self.vel_y;
        self.angle  += self.rotation;
        self.angle  = self.angle % 360.0;

        // Clip to the play area
        if self.x < 0.0 { self.x = 1000.0 };
        if self.y < 0.0 { self.y = 1000.0 };

        if self.x > 1000.0 { self.x = 0.0 };
        if self.y > 1000.0 { self.y = 0.0 };

        // Apply thrust
        let (acc_x, acc_y) = Transform2D::rotate_degrees(self.angle as _).transform_point(0.0, self.thrust as _);
        self.vel_x += acc_x as f64;
        self.vel_y += acc_y as f64;

        // Friction
        self.vel_x *= 0.99;
        self.vel_y *= 0.99;
    }
///
/// Updates the ship state after a tick
///
Updates the ship state after a tick
Updates the ship state after a tick
pub fn tick(&mut self) {
        // Move the ship
        self.x      += self.vel_x;
        self.y      += self.vel_y;
        self.angle  += self.rotation;
        self.angle  = self.angle % 360.0;
        // Clip to the play area
        if self.x < 0.0 { self.x = 1000.0 };
        if self.y < 0.0 { self.y = 1000.0 };
        if self.x > 1000.0 { self.x = 0.0 };
        if self.y > 1000.0 { self.y = 0.0 };
        // Apply thrust
        let (acc_x, acc_y) = Transform2D::rotate_degrees(self.angle as _).transform_point(0.0, self.thrust as _);
        self.vel_x += acc_x as f64;
        self.vel_y += acc_y as f64;
        // Friction
        self.vel_x *= 0.99;
        self.vel_y *= 0.99;
    }
pub fn tick ( & mut self ) { // Move the ship self . x += self . vel_x ; self . y += self . vel_y ; self . angle += self . rotation ; self . angle = self . angle % 360.0 ; // Clip to the play area if self . x < 0.0 { self . x = 1000.0 } ; if self . y < 0.0 { self . y = 1000.0 } ; if self . x > 1000.0 { self . x = 0.0 } ; if self . y > 1000.0 { self . y = 0.0 } ; // Apply thrust let ( acc_x , acc_y ) = Transform2D :: rotate_degrees ( self . angle as _ ) . transform_point ( 0.0 , self . thrust as _ ) ; self . vel_x += acc_x as f64 ; self . vel_y += acc_y as f64 ; // Friction self . vel_x *= 0.99 ; self . vel_y *= 0.99 ; }
Updates the ship state after a tick
Updates the ship state after a tick
&mut self