Skip to content

Commit

Permalink
use y axis in case of different image source dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
csidam committed Feb 4, 2024
1 parent c971a98 commit cd36b90
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ fn main() -> Result<(), String> {
let sprite_tile_size = (32, 32);

// Baby - walk animation
let mut source_rect_0 = Rect::new(0, 0, sprite_tile_size.0, sprite_tile_size.0);
let mut dest_rect_0 = Rect::new(0, 0, sprite_tile_size.0 * 4, sprite_tile_size.0 * 4);
let mut source_rect_0 = Rect::new(0, 0, sprite_tile_size.0, sprite_tile_size.1);
let mut dest_rect_0 = Rect::new(0, 0, sprite_tile_size.0 * 4, sprite_tile_size.1 * 4);
dest_rect_0.center_on(Point::new(-64, 120));

// King - walk animation
let mut source_rect_1 = Rect::new(0, 32, sprite_tile_size.0, sprite_tile_size.0);
let mut dest_rect_1 = Rect::new(0, 32, sprite_tile_size.0 * 4, sprite_tile_size.0 * 4);
let mut source_rect_1 = Rect::new(0, 32, sprite_tile_size.0, sprite_tile_size.1);
let mut dest_rect_1 = Rect::new(0, 32, sprite_tile_size.0 * 4, sprite_tile_size.1 * 4);
dest_rect_1.center_on(Point::new(0, 240));

// Soldier - walk animation
let mut source_rect_2 = Rect::new(0, 64, sprite_tile_size.0, sprite_tile_size.0);
let mut dest_rect_2 = Rect::new(0, 64, sprite_tile_size.0 * 4, sprite_tile_size.0 * 4);
let mut source_rect_2 = Rect::new(0, 64, sprite_tile_size.0, sprite_tile_size.1);
let mut dest_rect_2 = Rect::new(0, 64, sprite_tile_size.0 * 4, sprite_tile_size.1 * 4);
dest_rect_2.center_on(Point::new(440, 360));

let mut running = true;
Expand Down

0 comments on commit cd36b90

Please sign in to comment.