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 {
|
2023-12-20 20:06:54 -08:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|