pub fn update(&mut self) {
        // Collide with the edges of the screen
        if self.x+self.dx+self.radius > 1000.0 && self.dx > 0.0     { self.dx = -self.dx; }
        if self.y+self.dy+self.radius > 1000.0 && self.dy > 0.0     { self.dy = -self.dy; }
        if self.x+self.dx-self.radius < 0.0 && self.dx < 0.0        { self.dx = -self.dx; }
        if self.y+self.dy-self.radius < 0.0 && self.dy < 0.0        { self.dy = -self.dy; }

        // Gravity
        if self.y >= self.radius {
            self.dy -= 0.2;
        }

        // Move this ball in whatever direction it's going
        self.x += self.dx;
        self.y += self.dy;
    }
///
/// Moves this ball on one frame
///
Moves this ball on one frame
Moves this ball on one frame
pub fn update(&mut self) {
        // Collide with the edges of the screen
        if self.x+self.dx+self.radius > 1000.0 && self.dx > 0.0     { self.dx = -self.dx; }
        if self.y+self.dy+self.radius > 1000.0 && self.dy > 0.0     { self.dy = -self.dy; }
        if self.x+self.dx-self.radius < 0.0 && self.dx < 0.0        { self.dx = -self.dx; }
        if self.y+self.dy-self.radius < 0.0 && self.dy < 0.0        { self.dy = -self.dy; }
        // Gravity
        if self.y >= self.radius {
            self.dy -= 0.2;
        }
        // Move this ball in whatever direction it's going
        self.x += self.dx;
        self.y += self.dy;
    }
pub fn update ( & mut self ) { // Collide with the edges of the screen if self . x + self . dx + self . radius > 1000.0 && self . dx > 0.0 { self . dx = - self . dx ; } if self . y + self . dy + self . radius > 1000.0 && self . dy > 0.0 { self . dy = - self . dy ; } if self . x + self . dx - self . radius < 0.0 && self . dx < 0.0 { self . dx = - self . dx ; } if self . y + self . dy - self . radius < 0.0 && self . dy < 0.0 { self . dy = - self . dy ; } // Gravity if self . y >= self . radius { self . dy -= 0.2 ; } // Move this ball in whatever direction it's going self . x += self . dx ; self . y += self . dy ; }
Moves this ball on one frame
Moves this ball on one frame
&mut self