summaryrefslogtreecommitdiff
path: root/2026/games_submissions/rpc2dot0/src/effects.rs
blob: 02b33efcd108344dcf05ff43e8ecba5d2093418a (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use crate::color::EntityColor;
use crate::constants::*;

#[derive(Debug, Clone)]
pub struct PacmanChase {
    pub speed: f32,
}

impl PacmanChase {
    pub fn new(speed: f32) -> Self {
        Self { speed }
    }
}

impl Default for PacmanChase {
    fn default() -> Self {
        Self::new(BASE_SPEED)
    }
}
#[derive(Debug, Clone)]
pub struct Rogue {
    pub until_ms: f32,
    pub hover_color: EntityColor,
}

impl Rogue {
    pub fn new(until_ms: f32, hover_color: EntityColor) -> Self {
        Self {
            until_ms,
            hover_color,
        }
    }
}

impl Default for Rogue {
    fn default() -> Self {
        Self::new(ROGUE_DURATION_MS, EntityColor::Yellow)
    }
}

pub struct Explosion {
    pub x: f32,
    pub y: f32,
    pub age_ms: f32,
    pub duration_ms: f32,
    pub radius: f32,
}
impl Explosion {
    pub fn new(x: f32, y: f32) -> Self {
        Self {
            x,
            y,
            age_ms: 0.0,
            duration_ms: 400.0,
            radius: 8.0,
        }
    }
}