Game gets more difficult as you continue

This commit is contained in:
Daniel Flanagan 2021-11-15 11:06:17 -06:00
parent 7fdb89b274
commit 17e6b5c17c
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
2 changed files with 5 additions and 5 deletions

View file

@ -13,8 +13,9 @@
</script>
<style>
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body, html { background-color: #111; display: flex; height: 100vh; width: 100vw; justify-content: center; align-items: center; flex-direction: column; font-family: sans-serif; }
canvas { margin-bottom: 1em; }
body, html { background-color: #111; display: flex; min-height: 100vh; max-width: 100vw; justify-content: center; align-items: center; flex-direction: column; font-family: sans-serif; }
canvas { margin-bottom: 1em; max-height: 100vh; max-width: 100vw; }
a { color: #fff; margin-bottom: 1em; }
</style>
</body>
</html>

View file

@ -4,6 +4,7 @@
use bracket_lib::prelude::*;
use std::collections::VecDeque;
const VERSION: &str = "0.3.0";
const SCREEN_WIDTH: u16 = 80;
const SCREEN_HEIGHT: u16 = 50;
const FRAME_DURATION: f32 = 35.0;
@ -21,12 +22,10 @@ struct Obstacle {
impl Obstacle {
fn new(x: i32, score: u32) -> Self {
let mut random = RandomNumberGenerator::new();
// TODO: make smaller with score
Obstacle {
x,
gap_y: random.range(10, 40),
// TODO: increase difficulty
gap_height: u16::max(2, 15),
gap_height: u16::max(5, 20 - (score as u16 / 3)),
}
}