From 83ff2ad49e6d3bf83fd85fcfee68a454372bf22a Mon Sep 17 00:00:00 2001 From: tom barrett Date: Thu, 4 Jul 2019 07:39:51 -0500 Subject: moved animation file, moved player function to enitity, tile now uses animation, move drawing from npc tile player to animation --- src/npc.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/npc.rs') 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) { -- cgit v1.2.3