fn initialise_ball(world: &mut World, spritesheet: TextureHandle) {
    use {ARENA_HEIGHT, ARENA_WIDTH, BALL_RADIUS, BALL_VELOCITY_X, BALL_VELOCITY_Y, PADDLE_WIDTH};

    // Create the translation.
    let mut local_transform = Transform::default();
    local_transform.translation = Vector3::new(ARENA_WIDTH / 2.0, ARENA_HEIGHT / 2.0, 0.0);

    // Create the sprite for the ball.
    let sprite = Sprite {
        left: PADDLE_WIDTH,
        right: SPRITESHEET_SIZE.0,
        top: 0.0,
        bottom: BALL_RADIUS * 2.0,
    };

    world
        .create_entity()
        .with_sprite(&sprite, spritesheet, SPRITESHEET_SIZE)
        .expect("Error creating SpriteRender for ball")
        .with(Ball {
            radius: BALL_RADIUS,
            velocity: [BALL_VELOCITY_X, BALL_VELOCITY_Y],
        })
        .with(local_transform)
        .with(GlobalTransform::default())
        .build();
}
/// Initialises one ball in the middle-ish of the arena.
Initialises one ball in the middle-ish of the arena.
Initialises one ball in the middle - ish of the arena .
fn initialise_ball(world: &mut World, spritesheet: TextureHandle) {
    use {ARENA_HEIGHT, ARENA_WIDTH, BALL_RADIUS, BALL_VELOCITY_X, BALL_VELOCITY_Y, PADDLE_WIDTH};
    // Create the translation.
    let mut local_transform = Transform::default();
    local_transform.translation = Vector3::new(ARENA_WIDTH / 2.0, ARENA_HEIGHT / 2.0, 0.0);
    // Create the sprite for the ball.
    let sprite = Sprite {
        left: PADDLE_WIDTH,
        right: SPRITESHEET_SIZE.0,
        top: 0.0,
        bottom: BALL_RADIUS * 2.0,
    };
    world
        .create_entity()
        .with_sprite(&sprite, spritesheet, SPRITESHEET_SIZE)
        .expect("Error creating SpriteRender for ball")
        .with(Ball {
            radius: BALL_RADIUS,
            velocity: [BALL_VELOCITY_X, BALL_VELOCITY_Y],
        })
        .with(local_transform)
        .with(GlobalTransform::default())
        .build();
}
fn initialise_ball ( world : & mut World , spritesheet : TextureHandle ) { use { ARENA_HEIGHT , ARENA_WIDTH , BALL_RADIUS , BALL_VELOCITY_X , BALL_VELOCITY_Y , PADDLE_WIDTH } ; // Create the translation. let mut local_transform = Transform :: default ( ) ; local_transform . translation = Vector3 :: new ( ARENA_WIDTH / 2.0 , ARENA_HEIGHT / 2.0 , 0.0 ) ; // Create the sprite for the ball. let sprite = Sprite { left : PADDLE_WIDTH , right : SPRITESHEET_SIZE . 0 , top : 0.0 , bottom : BALL_RADIUS * 2.0 , } ; world . create_entity ( ) . with_sprite ( & sprite , spritesheet , SPRITESHEET_SIZE ) . expect ( " " ) . with ( Ball { radius : BALL_RADIUS , velocity : [ BALL_VELOCITY_X , BALL_VELOCITY_Y ] , } ) . with ( local_transform ) . with ( GlobalTransform :: default ( ) ) . build ( ) ; }
Initialises one ball in the middle-ish of the arena.
Initialises one ball in the middle - ish of the arena .
world
&mut World
spritesheet
TextureHandle
world
&mut World
spritesheet
TextureHandle