+ if self.pos.x <= 0.0 || self.pos.x >= 1280.0 { // only for testing
+ self.pos.x = self.pos.x.max(0.0).min(1280.0);
+ self.vel.x = -self.vel.x;
+ self.bounces = 0;
+ use rand::distributions::{Distribution, Normal};
+ let normal = Normal::new(0.5, 0.4);
+ objects.push(Box::new(Boll {
+ vel: self.vel * normal.sample(&mut rand::thread_rng()),
+ ..*self
+ }));
+ }
+