resizing everything

This commit is contained in:
Evan Pratten 2021-04-24 12:16:38 -04:00
parent 12ed150a17
commit 09c776ba3f
5 changed files with 48 additions and 44 deletions

View File

@ -3,8 +3,8 @@ 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};
const FISH_FOLLOW_PLAYER_DISTANCE: f32 = 80.0; const FISH_FOLLOW_PLAYER_DISTANCE: f32 = 30.0;
const FISH_FOLLOW_PLAYER_SPEED: f32 = 2.0; const FISH_FOLLOW_PLAYER_SPEED: f32 = 1.8;
const FISH_FOLLOW_PLAYER_SPEED_FAST: f32 = FISH_FOLLOW_PLAYER_SPEED * 3.0; const FISH_FOLLOW_PLAYER_SPEED_FAST: f32 = FISH_FOLLOW_PLAYER_SPEED * 3.0;
const FISH_ATTACH_RADIUS: f32 = 20.0; const FISH_ATTACH_RADIUS: f32 = 20.0;
@ -74,7 +74,7 @@ impl FishEntity {
direction_to_player.normalize(); direction_to_player.normalize();
// Handle player picking up fish // Handle player picking up fish
if player.position.distance_to(self.position).abs() <= player.size.y * 1.2 { if player.position.distance_to(self.position).abs() <= player.size.y * 2.2 {
self.following_player = true; self.following_player = true;
} }

View File

@ -119,7 +119,7 @@ impl GameCore {
offset: Vector2::zero(), offset: Vector2::zero(),
target: Vector2::zero(), target: Vector2::zero(),
rotation: 0.0, rotation: 0.0,
zoom: 1.0, zoom: 2.0,
}, },
show_simple_debug_info: false, show_simple_debug_info: false,
world: world, world: world,

View File

@ -61,6 +61,7 @@ impl Screen for InGameScreen {
x: (win_width as f32 / 2.0), x: (win_width as f32 / 2.0),
y: (win_height as f32 / 2.0), y: (win_height as f32 / 2.0),
}; };
let camera_window_center = window_center * (1.0 / game_core.master_camera.zoom);
// Update player movement // Update player movement
playerlogic::update_player_movement(draw_handle, game_core, window_center); playerlogic::update_player_movement(draw_handle, game_core, window_center);

View File

@ -5,10 +5,10 @@ use crate::{
pallette::{TRANSLUCENT_WHITE_128, TRANSLUCENT_WHITE_64, TRANSLUCENT_WHITE_96}, pallette::{TRANSLUCENT_WHITE_128, TRANSLUCENT_WHITE_64, TRANSLUCENT_WHITE_96},
}; };
const NORMAL_PLAYER_SPEED: i32 = 4; const NORMAL_PLAYER_SPEED: i32 = 3;
const BOOST_PLAYER_SPEED: i32 = NORMAL_PLAYER_SPEED * 2; const BOOST_PLAYER_SPEED: i32 = NORMAL_PLAYER_SPEED * 2;
const CAMERA_FOLLOW_SPEED: f32 = 0.7; const CAMERA_FOLLOW_SPEED: f32 = 0.7;
const TURN_SPEED: f32 = 0.05; const TURN_SPEED: f32 = 0.15;
const BOOST_DECREASE_PER_SECOND: f32 = 0.75; const BOOST_DECREASE_PER_SECOND: f32 = 0.75;
const BOOST_REGEN_PER_SECOND: f32 = 0.25; const BOOST_REGEN_PER_SECOND: f32 = 0.25;
const BREATH_DECREASE_PER_SECOND: f32 = 0.01; const BREATH_DECREASE_PER_SECOND: f32 = 0.01;
@ -135,9 +135,12 @@ pub fn render_player(context_2d: &mut RaylibMode2D<RaylibDrawHandle>, game_core:
TRANSLUCENT_WHITE_64, TRANSLUCENT_WHITE_64,
); );
context_2d.draw_ring( context_2d.draw_ring(
player.position, Vector2 {
boost_ring_max_radius - 2.0, x: player.position.x as i32 as f32,
boost_ring_max_radius + 2.0, y: player.position.y as i32 as f32,
},
boost_ring_max_radius ,
boost_ring_max_radius + 1.0,
0, 0,
(360.0 * player.breath_percent) as i32, (360.0 * player.breath_percent) as i32,
0, 0,

View File

@ -17,8 +17,8 @@ impl Player {
Self { Self {
boost_percent: 1.0, boost_percent: 1.0,
size: Vector2 { size: Vector2 {
x: 11.0 * 4.0, x: 11.0,
y: 21.0 * 4.0 y: 21.0
}, },
breath_percent: 1.0, breath_percent: 1.0,
..Default::default() ..Default::default()