summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2020-03-25 06:51:22 -0500
committerTom Barrett <tom@tombarrett.xyz>2020-03-25 06:51:22 -0500
commit8cdbe7352c4846eb339358bcca6083f747e27721 (patch)
tree36dee15239e98a3c10c5696a4ad696acaf65d39a /src
parent6d78a950473a4f34df6bae98d2bf2c99632afe4a (diff)
cargo update & lint
Diffstat (limited to 'src')
-rw-r--r--src/animations.rs8
-rw-r--r--src/tile.rs4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/animations.rs b/src/animations.rs
index b82b42e..cbaad41 100644
--- a/src/animations.rs
+++ b/src/animations.rs
@@ -67,7 +67,7 @@ impl Animations {
idle.source.h *= 2.0;
let animation = Animation::new(vec![idle.clone()]);
- available.insert(Action::IdleLeft, animation.clone());
+ available.insert(Action::IdleLeft, animation);
let mut moving = tileset.get_tile_by_entity_keyframe("player-top", 1);
moving.source.h *= 2.0;
@@ -75,15 +75,15 @@ impl Animations {
let animation = Animation::new(vec![idle.clone(), moving.clone()]);
available.insert(Action::MovingLeft, animation.clone());
available.insert(Action::MovingUpLeft, animation.clone());
- available.insert(Action::MovingDownLeft, animation.clone());
+ available.insert(Action::MovingDownLeft, animation);
let idle = flip(idle);
let moving = flip(moving);
let animation = Animation::new(vec![idle.clone()]);
- available.insert(Action::IdleRight, animation.clone());
+ available.insert(Action::IdleRight, animation);
- let animation = Animation::new(vec![idle.clone(), moving.clone()]);
+ let animation = Animation::new(vec![idle, moving]);
available.insert(Action::MovingRight, animation.clone());
available.insert(Action::MovingUpRight, animation.clone());
available.insert(Action::MovingDownRight, animation.clone());
diff --git a/src/tile.rs b/src/tile.rs
index aa950df..d6f5c0e 100644
--- a/src/tile.rs
+++ b/src/tile.rs
@@ -109,14 +109,14 @@ pub fn convert_angle_to_rad(angle: f32) -> f32 {
}
pub fn flip(tile: Tile) -> Tile {
- let mut t = tile.clone();
+ let mut t = tile;
t.source.x *= -1.0;
t.source.x -= t.source.w;
t
}
pub fn rotate(tile: Tile, angle: f32) -> Tile {
- let mut t = tile.clone();
+ let mut t = tile;
t.properties.rotation = convert_angle_to_rad(angle);
t
}