Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Game {
- score: u32,
- stage_width: u32,
- rusto_id: Vec<u32>,
- rusto_pos: HashMap<u32,(u32,u32)>,
- rusto_color: HashMap<u32, types::Color>,
- drop_timer: f64,
- blob: Option<Blob>
- }
- impl Game {
- fn rusto_blob_position(&self) -> Position {
- let main_rusto = self.blob.unwrap().rustos[0];
- let (main_rusto_x, main_rusto_y) = *self.rusto_pos.get(&main_rusto).unwrap();
- let (side_rusto_x, side_rusto_y) = *self.rusto_pos.get(&main_rusto).unwrap();
- if side_rusto_x < main_rusto_x {
- Position::OnLeft
- } else if side_rusto_x > main_rusto_x {
- Position::OnRight
- } else if side_rusto_y < main_rusto_y {
- Position::OnTop
- } else {
- Position::OnBottom
- }
- }
- }
- struct Blob {
- rustos: Vec<u32>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement