Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Engel Simulator 2020
Engel Simulator 2020
Commits
76a9d685
Commit
76a9d685
authored
Dec 21, 2020
by
Rahix
🦀
Browse files
Merge 'matebottledrop addition'
See merge request
!14
parents
2c80a963
e400843d
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/components/matebottledrop.rs
0 → 100644
View file @
76a9d685
pub
struct
Matebottledrop
;
src/components/mod.rs
View file @
76a9d685
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
;
src/entities/matebottledrop.rs
0 → 100644
View file @
76a9d685
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
),
));
}
}
src/entities/mod.rs
View file @
76a9d685
mod
matebottledrop
;
mod
player
;
pub
use
matebottledrop
::
create_drop_points
;
pub
use
player
::
create_player
;
src/states/ingame.rs
View file @
76a9d685
...
...
@@ -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
();
...
...
src/systems/mod.rs
View file @
76a9d685
...
...
@@ -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
;
src/systems/tmp_matebottledrop.rs
0 → 100644
View file @
76a9d685
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
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment