summaryrefslogtreecommitdiff
path: root/src/npc.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-07-04 07:39:51 -0500
committertom barrett <spalf0@gmail.com>2019-07-04 07:39:51 -0500
commit83ff2ad49e6d3bf83fd85fcfee68a454372bf22a (patch)
tree029ab8bd9d73652f1fabd9e34e970f16f93116b5 /src/npc.rs
parentc9ce92e1830505269b631ba1fdd864a173bacf48 (diff)
moved animation file, moved player function to enitity, tile now uses animation, move drawing from npc tile player to animation
Diffstat (limited to 'src/npc.rs')
-rw-r--r--src/npc.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/npc.rs b/src/npc.rs
index 48e08b9..9316e69 100644
--- a/src/npc.rs
+++ b/src/npc.rs
@@ -1,9 +1,7 @@
-use ggez::graphics::{spritebatch::SpriteBatch, DrawParam};
-use ggez::nalgebra::{/*distance,*/ Point2, Vector2};
-//use std::time::Instant;
+use ggez::graphics::spritebatch::SpriteBatch;
+use ggez::nalgebra::Point2;
-use crate::animation::Animations;
-use crate::constants;
+use crate::animations::Animations;
use crate::entity::{Entity, Operable};
use crate::map::Map;
use crate::tileset::Tileset;
@@ -17,12 +15,7 @@ pub struct NPC {
impl Operable for NPC {
fn draw(&self, spritebatch: &mut SpriteBatch) {
- spritebatch.add(
- DrawParam::default()
- .src(self.animations.current.current.source)
- .dest(self.entity.position)
- .scale(Vector2::new(constants::TILE_SCALE, constants::TILE_SCALE)),
- );
+ self.animations.draw(spritebatch, self.entity.position);
}
fn update(&mut self) {