add player to game
This commit is contained in:
parent
c6f6415d8d
commit
b72cfae04b
4 changed files with 14 additions and 3 deletions
|
@ -3,7 +3,8 @@ use bevy_rapier2d::prelude::*;
|
|||
use player::player_plugin;
|
||||
|
||||
mod player;
|
||||
mod set;
|
||||
|
||||
fn game_plugin(app: &mut App) {
|
||||
app.add_plugins((player_plugin));
|
||||
app.add_plugins(player_plugin);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use bevy_rapier2d::prelude::*;
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
use super::set::IngameSet;
|
||||
#[derive(Component)]
|
||||
struct Player {}
|
||||
|
||||
pub(super) fn player_plugin(app: &mut App) {
|
||||
//app.add_systems(OnEnter(AppState::InGame), add_player.in_set(GameplaySet));
|
||||
app.add_systems(OnEnter(AppState::InGame), add_player.in_set(IngameSet));
|
||||
}
|
||||
|
||||
pub fn add_player(mut commands: Commands) {
|
||||
commands.spawn(Player {});
|
||||
commands
|
||||
.spawn(Player {})
|
||||
.insert(ActiveEvents::COLLISION_EVENTS);
|
||||
}
|
||||
|
|
4
src/game/set.rs
Normal file
4
src/game/set.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct IngameSet;
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused)]
|
||||
use bevy::prelude::*;
|
||||
use bevy_rapier2d::prelude::*;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue