Commit 76a9d685 authored by Rahix's avatar Rahix 🦀
Browse files

Merge 'matebottledrop addition'

See merge request !14
parents 2c80a963 e400843d
pub struct Matebottledrop;
mod edge;
mod matebottledrop;
mod movable;
mod node;
mod orbitbody;
......@@ -6,15 +7,15 @@ mod player;
mod position;
mod thesun;
pub use edge::draw_edges_system;
pub use edge::Edge;
pub use matebottledrop::Matebottledrop;
pub use movable::Movable;
pub use node::Node;
pub use node::{draw_nodes_system, update_nodes_system};
pub use orbitbody::{update_gravity_system, update_movement_system};
pub use orbitbody::{Gravity, OrbitBody};
pub use player::Player;
pub use position::Position;
pub use thesun::TheSun;
pub use edge::draw_edges_system;
pub use node::{draw_nodes_system, update_nodes_system};
pub use orbitbody::{update_gravity_system, update_movement_system};
pub use thesun::draw_thesun_system;
pub use thesun::TheSun;
use crate::colliders;
use crate::components;
use crate::svg_loader;
use rand::seq::SliceRandom;
pub fn create_drop_points(world: &mut legion::World, level: &svg_loader::SvgLevel) {
let spawn_locations = level
.spawnpoints
.get("bottledrop")
.expect("no mate bottle drops spawn in this map");
if spawn_locations.len() < 4 {
panic!("to few bottledrops");
}
for droppoint in spawn_locations.choose_multiple(&mut rand::thread_rng(), 4) {
world.push((
components::Matebottledrop,
components::Position::new(droppoint.x, droppoint.y),
colliders::Collider::new_circle_collider(50.0),
));
}
}
mod matebottledrop;
mod player;
pub use matebottledrop::create_drop_points;
pub use player::create_player;
......@@ -33,7 +33,7 @@ impl InGameState {
let player = entities::create_player(&mut world, &level);
resources.insert(resources::Player(player));
entities::create_drop_points(&mut world, &level);
level.apply_colliders(&mut world);
let schedule = legion::Schedule::builder()
......@@ -52,6 +52,7 @@ impl InGameState {
.add_thread_local(systems::draw_level_layer_system(background))
.add_thread_local(systems::draw_tmp_player_system())
.add_thread_local(systems::draw_level_layer_system(foreground))
.add_thread_local(systems::draw_tmp_matebottledrop_system())
// .add_thread_local(systems::draw_debug_colliders_system())
.build();
......
......@@ -3,6 +3,7 @@ mod draw_colliders;
mod level;
mod moving;
mod player;
mod tmp_matebottledrop;
mod tmp_player;
pub use camera::camera_system;
......@@ -10,4 +11,5 @@ pub use draw_colliders::draw_debug_colliders_system;
pub use level::draw_level_layer_system;
pub use moving::{move_camera_to_player_system, move_movable_system};
pub use player::{sanity_goes_up_and_down_system, update_sanity_bar_system};
pub use tmp_matebottledrop::draw_tmp_matebottledrop_system;
pub use tmp_player::draw_tmp_player_system;
use crate::colors;
use crate::components;
use crate::resources;
#[legion::system(for_each)]
pub fn draw_tmp_matebottledrop(
_player: &components::Matebottledrop,
pos: &components::Position,
#[resource] rendering: &mut resources::Rendering,
) {
rendering.begin_path();
rendering.set_fill_style(&colors::PRIMARY3_SHADE4);
rendering.arc(
pos.0.x as f64,
pos.0.y as f64,
50.0,
0.0,
std::f64::consts::TAU,
);
rendering.fill();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment