~ntgg/fundies2-game

ref: 3927e86c93ed4e0f694bf9bd05b7686b0f9e05d6 fundies2-game/src/components.rs -rw-r--r-- 424 bytes
3927e86c — Noah Graff fixed a typo 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::vec2::Vec2;
use ggez::Context;

#[derive(Copy, Clone)]
pub struct Pos(pub Vec2);
pub struct Vel(pub Vec2);

pub struct Bullet(pub u32);

impl Bullet {
    pub const SPEED: f32 = 400.0;
}

impl Bullet {
    pub fn size(&self) -> f32 {
        10.0_f32.min(self.0 as f32)
    }
}

pub struct Ship;

impl Ship {
    pub fn size(ctx: &Context) -> f32 {
        ggez::graphics::screen_coordinates(ctx).h / 35.0
    }
}