Compare commits
2 Commits
b8e067f4e4
...
adc11ec654
Author | SHA1 | Date |
---|---|---|
Johannes Hendrik Gerard van der Weide | adc11ec654 | |
Johannes Hendrik Gerard van der Weide | 2720215da7 |
20
README.md
20
README.md
|
@ -1,19 +1,5 @@
|
||||||
# RustThingy
|
# RustThingy
|
||||||
|
|
||||||
This place is a message... and part of a system of messages... pay attention to it!
|
Welcome to the development branch!
|
||||||
|
Expect it to be broken as any progress will be pushed.
|
||||||
Sending this message was important to us. We considered ourselves to be a powerful culture.
|
If you need a gauranty of it compiling propperly use main.
|
||||||
|
|
||||||
This place is not a place of honor... no highly esteemed deed is commemorated here... nothing valued is here.
|
|
||||||
|
|
||||||
What is here was dangerous and repulsive to us. This message is a warning about danger.
|
|
||||||
|
|
||||||
The danger is in a particular location... it increases towards a center... the center of danger is here... of a particular size and shape, and below us.
|
|
||||||
|
|
||||||
The danger is still present, in your time, as it was in ours.
|
|
||||||
|
|
||||||
The danger is to the body, and it can kill.
|
|
||||||
|
|
||||||
The form of the danger is an emanation of energy.
|
|
||||||
|
|
||||||
The danger is unleashed only if you substantially disturb this place physically. This place is best shunned and left uninhabited.
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
use bevy::prelude::*;
|
||||||
|
use serde::{Serialize, Deserialze};
|
||||||
|
use std::fs;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub struct LevelgenPlugin;
|
||||||
|
|
||||||
|
impl Plugin for LevelgenPlugin {
|
||||||
|
fn build(&self, app: &mut App) {
|
||||||
|
app.add_systems(Startup, setup_levels)
|
||||||
|
.add_systems(Update, level_generation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct Level {
|
||||||
|
enemies: Vec<String>,
|
||||||
|
waves: u32,
|
||||||
|
treasure: i32,
|
||||||
|
doors: Vec<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component)]
|
||||||
|
pub struct LevelGenerator {
|
||||||
|
levels_exit_north: Vec<String>,
|
||||||
|
levels_exit_east: Vec<String>,
|
||||||
|
levels_exit_south: Vec<String>,
|
||||||
|
levels_exit_west: Vec<String>,
|
||||||
|
path: Vec<String>,
|
||||||
|
current_enemies: Vec<u32>,
|
||||||
|
current_waves: u32,
|
||||||
|
current_treasure: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn setup_levels(mut commands: Commands) {
|
||||||
|
let mut initial_level: String = "
|
||||||
|
# Enemies can only be set if they exist in data/enemies/
|
||||||
|
# for example data/enemies/grunt.yml
|
||||||
|
enemies: [
|
||||||
|
grunt
|
||||||
|
]
|
||||||
|
# 0 means no enemies
|
||||||
|
waves: 1
|
||||||
|
# 0 is no treasure
|
||||||
|
treasure: 0
|
||||||
|
doors: [
|
||||||
|
true, # North
|
||||||
|
true, # East
|
||||||
|
true, # South
|
||||||
|
true, # West
|
||||||
|
]
|
||||||
|
".to_string();
|
||||||
|
let initial_level_path = Path::new("./data/levels/initial_level.yml");
|
||||||
|
if initial_level_path.exists() {
|
||||||
|
initial_level =
|
||||||
|
fs::read_to_string("./data/levels/initial_level.yml").expect("Error reading data/levels/initial_level.yml");
|
||||||
|
} else {
|
||||||
|
fs::write("./data/levels/initial_level.yml", initial_level.clone())
|
||||||
|
.expect("Error writing data/levels/initial_level.yml");
|
||||||
|
}
|
||||||
|
let paths = fs::read_dir("./data/levels/").unwrap();
|
||||||
|
|
||||||
|
for path in paths {
|
||||||
|
}
|
||||||
|
commands.spawn((
|
||||||
|
LevelGenerator {
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn level_generation() {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue