diff options
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/bug.rs | 7 | ||||
-rw-r--r-- | src/entities/home.rs | 5 |
2 files changed, 3 insertions, 9 deletions
diff --git a/src/entities/bug.rs b/src/entities/bug.rs index f64669d..b5e31c7 100644 --- a/src/entities/bug.rs +++ b/src/entities/bug.rs @@ -13,13 +13,10 @@ const SPEED: f64 = 175.; impl Bug { pub fn new(x: f64, y: f64) -> Bug { - let pos = Vec2d { - x: x, - y: y - }; + let pos = Vec2d::new(x, y); let pos_unit = pos.unit(); Bug { - pos: pos, + pos, rotation: (-pos).angle(), velocity: -pos_unit * SPEED, alive: true diff --git a/src/entities/home.rs b/src/entities/home.rs index 2839f5d..5666a75 100644 --- a/src/entities/home.rs +++ b/src/entities/home.rs @@ -12,10 +12,7 @@ pub struct Home { impl Home { pub fn new(x: f64, y: f64) -> Home { Home { - pos: Vec2d { - x: x, - y: y - }, + pos: Vec2d::new(x, y), animation_time: 0., sprite: SpriteId::Sleepypug1 } |