diff --git a/src/engine.rs b/src/engine.rs index 358b490..97b554e 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -184,12 +184,7 @@ impl<'context, 'game> Context<'context, 'game> { self.canvas.copy( texture, None, - Rect::new( - x * 4, - y * 4, - texture.query().width * 4, - texture.query().height * 4, - ), + Rect::new(x, y, texture.query().width, texture.query().height), )?; Ok(()) } diff --git a/src/main.rs b/src/main.rs index ffd24a9..902b05a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ impl System for GravitySystem { fn on_update(&self, ctx: &mut engine::Context, delta: f64) -> Result<(), engine::Error> { for id in engine::Quwi::<(Gravity, Velocity)>::new().run(&ctx) { let Velocity(_, y) = ctx.entity_component::(id); - *y = if *y < 200.0 { *y + 100.0 * delta } else { *y }; + *y = if *y < 800.0 { *y + 400.0 * delta } else { *y }; } Ok(()) } @@ -70,9 +70,9 @@ impl System for PlayerMovementSystem { let a_down = ctx.key_pressed(engine::Keycode::A); let Velocity(x, _) = ctx.entity_component::(id); *x = if d_down && !a_down { - 100.0 + 400.0 } else if !d_down && a_down { - -100.0 + -400.0 } else { 0.0 }; @@ -92,8 +92,8 @@ fn main() { let sprite = context.load_sprite("textures/player.png").unwrap(); context.spawn(vec![ Box::new(Sprite { sprite }), - Box::new(Position(16.0, 140.0)), - Box::new(Velocity(0.0, -150.0)), + Box::new(Position(16.0, 500.0)), + Box::new(Velocity(0.0, -600.0)), Box::new(Gravity), Box::new(PlayerMovement), ]); diff --git a/textures/player.png b/textures/player.png index 881d686..55371d1 100644 Binary files a/textures/player.png and b/textures/player.png differ