From b0a8869805305b622222a301a07555a88de6dcf3 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Sat, 24 Apr 2021 13:31:34 -0400 Subject: [PATCH 1/2] Add credits to the pause menu --- src/logic/pausemenu.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/logic/pausemenu.rs b/src/logic/pausemenu.rs index 64daf35..30c91f4 100644 --- a/src/logic/pausemenu.rs +++ b/src/logic/pausemenu.rs @@ -7,7 +7,7 @@ use crate::{ use super::screen::Screen; -const SCREEN_PANEL_SIZE: Vector2 = Vector2 { x: 300.0, y: 300.0 }; +const SCREEN_PANEL_SIZE: Vector2 = Vector2 { x: 300.0, y: 380.0 }; pub struct PauseMenuScreen {} @@ -118,6 +118,15 @@ impl Screen for PauseMenuScreen { } } + // Render credits + draw_handle.draw_text( + "Credits:\n\t- @ewpratten\n\t- @rsninja722\n\t- @wm-c\n\t- @catarinaburghi", + (win_width / 2) - (SCREEN_PANEL_SIZE.x as i32 / 2) + 10, + (win_height / 2) - (SCREEN_PANEL_SIZE.y as i32 / 2) + 120, + 20, + Color::BLACK, + ); + // Close and quit buttons let bottom_left_button_dimensions = Rectangle { x: (win_width as f32 / 2.0) - (SCREEN_PANEL_SIZE.x / 2.0) + 5.0, From ef90e1ce66685528cf7f6cfed1788348f0c4d095 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Sat, 24 Apr 2021 13:59:08 -0400 Subject: [PATCH 2/2] fishy fish --- src/entities/fish.rs | 8 ++++---- src/logic/ingame/mod.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/entities/fish.rs b/src/entities/fish.rs index 7d994bc..452d9ed 100644 --- a/src/entities/fish.rs +++ b/src/entities/fish.rs @@ -1,7 +1,7 @@ use rand::{Rng, prelude::ThreadRng}; use raylib::prelude::*; -use crate::{gamecore::GameCore, lib::utils::triangles::rotate_vector, player::Player}; +use crate::{gamecore::GameCore, lib::utils::triangles::rotate_vector, player::Player, world::World}; const FISH_FOLLOW_PLAYER_DISTANCE: f32 = 30.0; const FISH_FOLLOW_PLAYER_SPEED: f32 = 1.8; @@ -36,7 +36,7 @@ impl FishEntity { return output; } - pub fn handle_follow_player(&mut self, player: &Player, dt: f64) { + pub fn handle_follow_player(&mut self, player: &Player, dt: f64, other_fish: &Vec) { // Distance and direction to player let dist_to_player = player.position - self.position; let dist_to_player_lin = self.position.distance_to(player.position); @@ -86,9 +86,9 @@ impl FishEntity { self.direction = direction_to_player; } - pub fn update_position(&mut self, player: &mut Player, dt: f64) { + pub fn update_position(&mut self, player: &mut Player, dt: f64, other_fish: &Vec) { if self.following_player { - self.handle_follow_player(player, dt); + self.handle_follow_player(player, dt, other_fish); } else { self.handle_free_movement(player, dt); } diff --git a/src/logic/ingame/mod.rs b/src/logic/ingame/mod.rs index 4a4e0a8..a5b640b 100644 --- a/src/logic/ingame/mod.rs +++ b/src/logic/ingame/mod.rs @@ -74,9 +74,9 @@ impl Screen for InGameScreen { self.render_world(&mut context_2d, game_core); // Render entities - let mut fish = &mut game_core.world.fish; - for fish in fish.iter_mut() { - fish.update_position(&mut game_core.player, dt); + let fish_clone = game_core.world.fish.clone(); + for fish in game_core.world.fish.iter_mut() { + fish.update_position(&mut game_core.player, dt, &fish_clone); fish.render(&mut context_2d); }