fn initialise_paddles(world: &mut World, spritesheet: TextureHandle) {
    let mut left_transform = Transform::default();
    let mut right_transform = Transform::default();

    // Correctly position the paddles.
    let y = ARENA_HEIGHT / 2.0;
    left_transform.translation = Vector3::new(PADDLE_WIDTH * 0.5, y, 0.0);
    right_transform.translation = Vector3::new(ARENA_WIDTH - PADDLE_WIDTH * 0.5, y, 0.0);

    // Build the sprite for the paddles.
    let sprite = Sprite {
        left: 0.0,
        right: PADDLE_WIDTH,
        top: 0.0,
        bottom: PADDLE_HEIGHT,
    };

    // Create a left plank entity.
    world
        .create_entity()
        .with_sprite(&sprite, spritesheet.clone(), SPRITESHEET_SIZE)
        .expect("Failed to add sprite render on left paddle")
        .with(Paddle::new(Side::Left))
        .with(GlobalTransform::default())
        .with(left_transform)
        .build();

    // Create right plank entity.
    world
        .create_entity()
        .with_sprite(&sprite, spritesheet, SPRITESHEET_SIZE)
        .expect("Failed to add sprite render on right paddle")
        .with(Paddle::new(Side::Right))
        .with(GlobalTransform::default())
        .with(right_transform)
        .build();
}
/// Initialises one paddle on the left, and one paddle on the right.
Initialises one paddle on the left, and one paddle on the right.
Initialises one paddle on the left and one paddle on the right .
fn initialise_paddles(world: &mut World, spritesheet: TextureHandle) {
    let mut left_transform = Transform::default();
    let mut right_transform = Transform::default();
    // Correctly position the paddles.
    let y = ARENA_HEIGHT / 2.0;
    left_transform.translation = Vector3::new(PADDLE_WIDTH * 0.5, y, 0.0);
    right_transform.translation = Vector3::new(ARENA_WIDTH - PADDLE_WIDTH * 0.5, y, 0.0);
    // Build the sprite for the paddles.
    let sprite = Sprite {
        left: 0.0,
        right: PADDLE_WIDTH,
        top: 0.0,
        bottom: PADDLE_HEIGHT,
    };
    // Create a left plank entity.
    world
        .create_entity()
        .with_sprite(&sprite, spritesheet.clone(), SPRITESHEET_SIZE)
        .expect("Failed to add sprite render on left paddle")
        .with(Paddle::new(Side::Left))
        .with(GlobalTransform::default())
        .with(left_transform)
        .build();
    // Create right plank entity.
    world
        .create_entity()
        .with_sprite(&sprite, spritesheet, SPRITESHEET_SIZE)
        .expect("Failed to add sprite render on right paddle")
        .with(Paddle::new(Side::Right))
        .with(GlobalTransform::default())
        .with(right_transform)
        .build();
}
fn initialise_paddles ( world : & mut World , spritesheet : TextureHandle ) { let mut left_transform = Transform :: default ( ) ; let mut right_transform = Transform :: default ( ) ; // Correctly position the paddles. let y = ARENA_HEIGHT / 2.0 ; left_transform . translation = Vector3 :: new ( PADDLE_WIDTH * 0.5 , y , 0.0 ) ; right_transform . translation = Vector3 :: new ( ARENA_WIDTH - PADDLE_WIDTH * 0.5 , y , 0.0 ) ; // Build the sprite for the paddles. let sprite = Sprite { left : 0.0 , right : PADDLE_WIDTH , top : 0.0 , bottom : PADDLE_HEIGHT , } ; // Create a left plank entity. world . create_entity ( ) . with_sprite ( & sprite , spritesheet . clone ( ) , SPRITESHEET_SIZE ) . expect ( " " ) . with ( Paddle :: new ( Side :: Left ) ) . with ( GlobalTransform :: default ( ) ) . with ( left_transform ) . build ( ) ; // Create right plank entity. world . create_entity ( ) . with_sprite ( & sprite , spritesheet , SPRITESHEET_SIZE ) . expect ( " " ) . with ( Paddle :: new ( Side :: Right ) ) . with ( GlobalTransform :: default ( ) ) . with ( right_transform ) . build ( ) ; }
Initialises one paddle on the left, and one paddle on the right.
Initialises one paddle on the left and one paddle on the right .
world
&mut World
spritesheet
TextureHandle
world
&mut World
spritesheet
TextureHandle