Galactica/src/doodad.rs

22 lines
376 B
Rust
Raw Normal View History

2023-12-22 17:24:53 -08:00
use cgmath::{Deg, Point2};
2023-12-22 21:39:47 -08:00
use crate::{physics::Pfloat, Sprite, Spriteable};
2023-12-22 17:24:53 -08:00
2023-12-20 19:05:12 -08:00
pub struct Doodad {
pub sprite: String,
2023-12-22 17:24:53 -08:00
pub pos: Point2<Pfloat>,
2023-12-22 22:10:38 -08:00
pub parallax: Pfloat,
2023-12-20 19:05:12 -08:00
}
2023-12-22 17:24:53 -08:00
impl Spriteable for Doodad {
2023-12-22 21:39:47 -08:00
fn sprite(&self) -> Sprite {
2023-12-22 16:51:21 -08:00
return Sprite {
2023-12-22 21:39:47 -08:00
pos: self.pos,
2023-12-22 16:51:21 -08:00
name: self.sprite.clone(),
2023-12-22 17:24:53 -08:00
angle: Deg { 0: 0.0 },
2023-12-22 19:18:03 -08:00
scale: 1.0,
2023-12-22 22:10:38 -08:00
parallax: self.parallax,
2023-12-22 16:51:21 -08:00
};
2023-12-20 19:05:12 -08:00
}
}