summaryrefslogtreecommitdiff
path: root/src/tile.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-07-05 02:50:38 -0500
committertom barrett <spalf0@gmail.com>2019-07-05 02:50:38 -0500
commit6589e5e3df63d5abf85313c4d21097432257f453 (patch)
treed53635ead10c9fa9dc951045eff9e31977457f8c /src/tile.rs
parent83ff2ad49e6d3bf83fd85fcfee68a454372bf22a (diff)
removed math, operable to map and layers, on the way to merging tile and frame
Diffstat (limited to 'src/tile.rs')
-rw-r--r--src/tile.rs13
1 files changed, 9 insertions, 4 deletions
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::<usize>().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,
}
}