fn initialise_paddles(world: &mut World, sprite_sheet_handle: Handle<SpriteSheet>) {
    use crate::{PADDLE_HEIGHT, PADDLE_VELOCITY, PADDLE_WIDTH};

    let mut left_transform = Transform::default();
    let mut right_transform = Transform::default();

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

    // Assign the sprites for the paddles
    let sprite_render = SpriteRender {
        sprite_sheet: sprite_sheet_handle,
        sprite_number: 0, // paddle is the first sprite in the sprite_sheet
    };

    // Create a left plank entity.
    world
        .create_entity()
        .with(sprite_render.clone())
        .with(Paddle {
            velocity: PADDLE_VELOCITY,
            side: Side::Left,
            width: PADDLE_WIDTH,
            height: PADDLE_HEIGHT,
        })
        .with(left_transform)
        .build();

    // Create right plank entity.
    world
        .create_entity()
        .with(sprite_render)
        .with(Paddle {
            velocity: PADDLE_VELOCITY,
            side: Side::Right,
            width: PADDLE_WIDTH,
            height: PADDLE_HEIGHT,
        })
        .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, sprite_sheet_handle: Handle<SpriteSheet>) {
    use crate::{PADDLE_HEIGHT, PADDLE_VELOCITY, PADDLE_WIDTH};
    let mut left_transform = Transform::default();
    let mut right_transform = Transform::default();
    // Correctly position the paddles.
    let y = ARENA_HEIGHT / 2.0;
    left_transform.set_translation_xyz(PADDLE_WIDTH * 0.5, y, 0.0);
    right_transform.set_translation_xyz(ARENA_WIDTH - PADDLE_WIDTH * 0.5, y, 0.0);
    // Assign the sprites for the paddles
    let sprite_render = SpriteRender {
        sprite_sheet: sprite_sheet_handle,
        sprite_number: 0, // paddle is the first sprite in the sprite_sheet
    };
    // Create a left plank entity.
    world
        .create_entity()
        .with(sprite_render.clone())
        .with(Paddle {
            velocity: PADDLE_VELOCITY,
            side: Side::Left,
            width: PADDLE_WIDTH,
            height: PADDLE_HEIGHT,
        })
        .with(left_transform)
        .build();
    // Create right plank entity.
    world
        .create_entity()
        .with(sprite_render)
        .with(Paddle {
            velocity: PADDLE_VELOCITY,
            side: Side::Right,
            width: PADDLE_WIDTH,
            height: PADDLE_HEIGHT,
        })
        .with(right_transform)
        .build();
}
fn initialise_paddles ( world : & mut World , sprite_sheet_handle : Handle < SpriteSheet > ) { use crate :: { PADDLE_HEIGHT , PADDLE_VELOCITY , PADDLE_WIDTH } ; let mut left_transform = Transform :: default ( ) ; let mut right_transform = Transform :: default ( ) ; // Correctly position the paddles. let y = ARENA_HEIGHT / 2.0 ; left_transform . set_translation_xyz ( PADDLE_WIDTH * 0.5 , y , 0.0 ) ; right_transform . set_translation_xyz ( ARENA_WIDTH - PADDLE_WIDTH * 0.5 , y , 0.0 ) ; // Assign the sprites for the paddles let sprite_render = SpriteRender { sprite_sheet : sprite_sheet_handle , sprite_number : 0 , // paddle is the first sprite in the sprite_sheet } ; // Create a left plank entity. world . create_entity ( ) . with ( sprite_render . clone ( ) ) . with ( Paddle { velocity : PADDLE_VELOCITY , side : Side :: Left , width : PADDLE_WIDTH , height : PADDLE_HEIGHT , } ) . with ( left_transform ) . build ( ) ; // Create right plank entity. world . create_entity ( ) . with ( sprite_render ) . with ( Paddle { velocity : PADDLE_VELOCITY , side : Side :: Right , width : PADDLE_WIDTH , height : PADDLE_HEIGHT , } ) . 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
sprite_sheet_handle
Handle<SpriteSheet>
world
&mut World
sprite_sheet_handle
Handle<SpriteSheet>