Galactica/src/doodad.rs

18 lines
311 B
Rust
Raw Normal View History

2023-12-22 16:51:21 -08:00
use crate::{physics::Cartesian, Camera, Sprite};
2023-12-20 19:05:12 -08:00
pub struct Doodad {
pub sprite: String,
2023-12-22 16:51:21 -08:00
pub pos: Cartesian,
2023-12-20 19:05:12 -08:00
}
2023-12-22 16:51:21 -08:00
impl Doodad {
pub fn sprite(&self, camera: &Camera) -> Sprite {
let p = self.pos - camera.pos;
2023-12-21 11:26:44 -08:00
2023-12-22 16:51:21 -08:00
return Sprite {
position: (p.x, p.y),
name: self.sprite.clone(),
angle: 0.0,
};
2023-12-20 19:05:12 -08:00
}
}