diff --git a/src/main.rs b/src/main.rs index d56ae7e..fa4c474 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,13 +64,28 @@ fn main() { Tuple::vector(2.2, 0.0, 21.0), ); + let mut ball2 = Projectile::new( + Tuple::point(195.0, 0.0, 0.0), + Tuple::vector(-2.2, 0.0, 21.0), + ); + + let mut ball3 = Projectile::new( + Tuple::point(299.0, 0.0, 0.0), + Tuple::vector(-2.2, 0.0, 21.0), + ); + let mut canvas = Canvas::new(300, 300); - let color = Color::new(1.0, 1.0, 0.0); + let color = Color::new(1.0, 0.0, 0.0); + let color2 = Color::new(0.0, 1.0, 0.0); + let color3 = Color::new(0.0, 0.0, 1.0); loop { canvas.write_pixel(ball.position.x() as usize, canvas.height() - (ball.position.z() as usize) - 1, color); + canvas.write_pixel(ball2.position.x() as usize, canvas.height() - (ball2.position.z() as usize) - 1, color2); + canvas.write_pixel(ball3.position.x() as usize, canvas.height() - (ball3.position.z() as usize) - 1, color3); ball.tick(&env); - println!("ball {}", ball); + ball2.tick(&env); + ball3.tick(&env); if ball.position.z() >= (canvas.height() - 1) as f32 || ball.position.z() < 0.0 || ball.position.x() >= (canvas.width() - 1) as f32