raycaster/sprite.rs
1use crate::prelude::*;
2
3#[derive(Clone, Debug, PartialEq)]
4pub struct Sprite {
5
6 pub x : f32,
7 pub y : f32,
8
9 pub tile : Tile,
10
11 /// Shrinks the sprite
12 pub shrink : i32,
13
14 /// Moves the sprite up and down
15 pub move_y : f32,
16
17 /// Distance from the player, used for sorting the sprites
18 /// Only used internally
19 pub distance : f32,
20}
21
22/// A tile
23impl Sprite {
24 /// Creates a new sprite
25 pub fn new(x: f32, y: f32, tile: Tile) -> Self {
26 Self {
27 x, y,
28 tile,
29 shrink : 1,
30 move_y : 0.0,
31 distance : 0.0,
32 }
33 }
34}