From 6589e5e3df63d5abf85313c4d21097432257f453 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Fri, 5 Jul 2019 02:50:38 -0500 Subject: removed math, operable to map and layers, on the way to merging tile and frame --- src/tile.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/tile.rs') diff --git a/src/tile.rs b/src/tile.rs index 144e764..b00f55e 100644 --- a/src/tile.rs +++ b/src/tile.rs @@ -1,10 +1,9 @@ use ggez::graphics::spritebatch::SpriteBatch; use ggez::nalgebra::Point2; -use crate::animations::{Animation, Frame}; +use crate::animations::{convert_angle_to_rad, flip, Animation, Frame}; use crate::constants; use crate::entity::Operable; -use crate::math::{convert_angle_to_rad, flip}; use crate::tileset::Tileset; #[derive(Debug, Clone)] @@ -37,6 +36,7 @@ impl Tile { pub fn new(text: &str, i: usize, tileset: &Tileset, width: usize, height: usize) -> Tile { let id = text.parse::().unwrap(); + /* let flip_d = (id & constants::FLIP_DIAGONAL_FLAG) == constants::FLIP_DIAGONAL_FLAG; let flip_h = (id & constants::FLIP_HORIZONTAL_FLAG) == constants::FLIP_HORIZONTAL_FLAG; let flip_v = (id & constants::FLIP_VERTICAL_FLAG) == constants::FLIP_VERTICAL_FLAG; @@ -58,6 +58,7 @@ impl Tile { //(false, false, false) => (), _ => (tileset.get(id), 0.0), }; + */ let x = i as f32 % width as f32; let y = (i as f32 / height as f32).floor(); @@ -68,12 +69,16 @@ impl Tile { constants::TILE_HEIGHT * constants::TILE_SCALE * y, //+ offset, ); - let mut animation = Animation::new(Frame::new(source, None, rotation)); + //let mut animation = Animation::new(Frame::new(source, None, rotation)); + /* + let frame = tileset.get_frame(id); + let mut animation = Animation::default(); animation.give_frames(tileset.get_frames(id)); + */ Tile { id, - animation, + animation: tileset.get_animation(id), destination, } } -- cgit v1.2.3