rearrage
This commit is contained in:
parent
320560f3c5
commit
449c5fa85b
1
falling/.gitignore
vendored
Normal file
1
falling/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
23
falling/roach.txt
Normal file
23
falling/roach.txt
Normal file
@ -0,0 +1,23 @@
|
||||
-__
|
||||
/ \
|
||||
| -___
|
||||
| / ________________________
|
||||
| / | |
|
||||
‾ |‾ / _ | Where is the princess? |
|
||||
/ | \ / | \ |________________________|
|
||||
/ ‾‾‾‾‾‾‾ \ / /
|
||||
__ / / \• •/ _|
|
||||
/ \ _/‾|‾\ / |
|
||||
_ / / \ / / |
|
||||
\/ / /|___/
|
||||
/ \
|
||||
/ \ / \
|
||||
| \ / \
|
||||
|\____\_/ \
|
||||
\ / / \ \ /
|
||||
\ / \ /
|
||||
/ / / /
|
||||
_| \ /_ |
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ fn generate_output(starting_level: u64, ending_level: u64, character_x_coord: u1
|
||||
} else {
|
||||
match object {
|
||||
-3 => output+="|", // Specific case for -3
|
||||
0 => output+="¯", // Specific case for 0
|
||||
0 => output+="■", // Specific case for 0
|
||||
-1 => output+="\\", // Specific case for -1
|
||||
-2 => output+="/", // Specific case for -2
|
||||
_ => output+=" " // Default, no print for other cases
|
||||
@ -61,8 +61,11 @@ fn generate_level(level_to_generate: u64, difficulty: i8, left_wall: &mut i16, r
|
||||
new_level.push(1)
|
||||
}
|
||||
|
||||
for i in *left_wall+1..*right_wall-1 {
|
||||
let object: i8 = rand::thread_rng().gen_range(0..difficulty);
|
||||
for i in *left_wall..*right_wall {
|
||||
let mut object: i8 = 1;
|
||||
if level_to_generate >= 5 || (i as f32) < (screen_width as f32 / 2.0)-5.0 || (i as f32) > (screen_width as f32 / 2.0)+5.0 {
|
||||
object = rand::thread_rng().gen_range(0..difficulty);
|
||||
}
|
||||
new_level[i as usize] = object;
|
||||
}
|
||||
for i in 0..*left_wall {
|
||||
@ -131,7 +134,6 @@ fn debug_mode_modify_variables(current_level: &mut u64) -> u8 {
|
||||
|
||||
fn check_if_alive(levels: &Vec<Vec<i8>>, level: usize, x_coord: usize) -> bool {
|
||||
if levels[level][x_coord] <= 0 {
|
||||
println!("GAME OVER");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
@ -153,9 +155,9 @@ fn input() -> String{
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let debug_mode = true; // Enable or disable debugging mode, it will print some useful stats and
|
||||
let debug_mode = false; // Enable or disable debugging mode, it will print some useful stats and
|
||||
// let you modify stats midgame with e
|
||||
let can_die = false; // I can't spell invinsiblitlity but this lets you not die...
|
||||
let can_die = true; // I can't spell invinsiblitlity but this lets you not die...
|
||||
|
||||
let mut levels: Vec<Vec<i8>> = Vec::new(); // Define variables for level
|
||||
|
||||
@ -166,19 +168,19 @@ fn main() {
|
||||
screen_height = screen_height - 17;
|
||||
}
|
||||
else {
|
||||
screen_height = screen_height - 1;
|
||||
screen_height = screen_height - 2;
|
||||
}
|
||||
|
||||
let stdout = Term::buffered_stdout();
|
||||
|
||||
let mut current_level: u64 = 0;
|
||||
let mut character_icon: char = 'µ';
|
||||
let mut character_icon: char = '☺';
|
||||
let mut x_coord: u16 = (screen_width as f32/ 2.0) as u16; // Distance from left wall
|
||||
let mut left_wall: i16 = rand::thread_rng().gen_range(0..((screen_width as f32/ 2.0)-5.0) as i16) as i16;
|
||||
let mut right_wall: i16 = rand::thread_rng().gen_range(((screen_width as f32 /2.0)+5.0) as i16..screen_width as i16) as i16;
|
||||
let mut preference: f32 = rand::thread_rng().gen_range(-2.0..3.0);
|
||||
let mut alive: bool = true;
|
||||
let mut difficulty: i8 = 6;
|
||||
let mut difficulty: i8 = 2;
|
||||
|
||||
|
||||
for i in 0..screen_height {
|
||||
@ -235,4 +237,26 @@ fn main() {
|
||||
break 'game_loop
|
||||
}
|
||||
}
|
||||
println!("GAME OVER");
|
||||
println!("You fell {:?}m before going SPLAT",current_level-1);
|
||||
println!(" -__");
|
||||
println!(" / \\");
|
||||
println!(" | -___");
|
||||
println!(" | / ________________________");
|
||||
println!(" | / | |");
|
||||
println!(" ‾ |‾ / _ | Where is the princess? |");
|
||||
println!(" / | \\ / | \\ |________________________|");
|
||||
println!(" / ‾‾‾‾‾‾‾ \\ / /");
|
||||
println!(" __ / / \\• •/ _|");
|
||||
println!(" / \\ _/‾|‾\\ / |");
|
||||
println!("_ / / \\ / / |");
|
||||
println!(" \\/ / /|___/");
|
||||
println!(" / \\ ");
|
||||
println!(" / \\ / \\");
|
||||
println!(" | \\ / \\");
|
||||
println!(" |\\____\\_/ \\");
|
||||
println!(" \\ / / \\ \\ /");
|
||||
println!(" \\ / \\ /");
|
||||
println!(" / / / /");
|
||||
println!(" _| \\ /_ |");
|
||||
}
|
Loading…
Reference in New Issue
Block a user