34 lines
798 B
Rust
34 lines
798 B
Rust
|
use crate::Drawable;
|
||
|
use macroquad::color::GREEN;
|
||
|
use macroquad::math::Vec2;
|
||
|
use macroquad::prelude::*;
|
||
|
|
||
|
pub(crate) struct Food {
|
||
|
pos: Vec2,
|
||
|
}
|
||
|
|
||
|
impl Food {
|
||
|
pub(crate) fn new(pos: Vec2) -> Self {
|
||
|
Food { pos }
|
||
|
}
|
||
|
#[rustfmt::skip]
|
||
|
pub(crate) fn init() -> Vec<Self> {
|
||
|
vec![
|
||
|
Food::new(Vec2::new(335., 75.)),
|
||
|
Food::new(Vec2::new(340., 75.)),
|
||
|
Food::new(Vec2::new(335., 80.)),
|
||
|
Food::new(Vec2::new(340., 80.)),
|
||
|
Food::new(Vec2::new(615., 195.)),
|
||
|
Food::new(Vec2::new(620., 195.)),
|
||
|
Food::new(Vec2::new(615., 200.)),
|
||
|
Food::new(Vec2::new(620., 200.)),
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl Drawable for Food {
|
||
|
fn draw(&self) {
|
||
|
draw_circle(self.pos.x, self.pos.y, 1., GREEN);
|
||
|
}
|
||
|
}
|