Game gets more difficult as you continue
This commit is contained in:
parent
7fdb89b274
commit
17e6b5c17c
|
@ -13,8 +13,9 @@
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
|
*, *::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; }
|
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; }
|
canvas { margin-bottom: 1em; max-height: 100vh; max-width: 100vw; }
|
||||||
|
a { color: #fff; margin-bottom: 1em; }
|
||||||
</style>
|
</style>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
use bracket_lib::prelude::*;
|
use bracket_lib::prelude::*;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
const VERSION: &str = "0.3.0";
|
||||||
const SCREEN_WIDTH: u16 = 80;
|
const SCREEN_WIDTH: u16 = 80;
|
||||||
const SCREEN_HEIGHT: u16 = 50;
|
const SCREEN_HEIGHT: u16 = 50;
|
||||||
const FRAME_DURATION: f32 = 35.0;
|
const FRAME_DURATION: f32 = 35.0;
|
||||||
|
@ -21,12 +22,10 @@ struct Obstacle {
|
||||||
impl Obstacle {
|
impl Obstacle {
|
||||||
fn new(x: i32, score: u32) -> Self {
|
fn new(x: i32, score: u32) -> Self {
|
||||||
let mut random = RandomNumberGenerator::new();
|
let mut random = RandomNumberGenerator::new();
|
||||||
// TODO: make smaller with score
|
|
||||||
Obstacle {
|
Obstacle {
|
||||||
x,
|
x,
|
||||||
gap_y: random.range(10, 40),
|
gap_y: random.range(10, 40),
|
||||||
// TODO: increase difficulty
|
gap_height: u16::max(5, 20 - (score as u16 / 3)),
|
||||||
gap_height: u16::max(2, 15),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue