lebron asset loading

This commit is contained in:
LorrensP-2158466
2025-04-05 17:56:24 +02:00
parent 9dc1c0f573
commit 8a0eff99d9
7 changed files with 128 additions and 6 deletions

View File

@@ -1,14 +1,29 @@
use bevy::prelude::*;
use asset_loading::ImageAssets;
use bevy::{prelude::*, state::app::StatesPlugin};
mod asset_loading;
fn main() -> AppExit {
App::new()
.add_plugins((DefaultPlugins))
.add_plugins((DefaultPlugins, asset_loading::plugin))
.init_state::<GameState>()
// We need to register components to make them visible to Blenvy
.register_type::<Player>()
.add_systems(Startup, setup)
.add_systems(OnExit(GameState::Loading), debug_our_king)
.run()
}
#[derive(States, Default, Clone, Eq, PartialEq, Debug, Hash)]
enum GameState {
/// During the loading State the loading_plugin will load our assets
#[default]
Loading,
/// During this State the actual game logic is executed
Playing,
/// Here the menu is drawn and waiting for player interaction
Menu,
}
#[derive(Component, Reflect)]
struct Player {
strength: f32,
@@ -20,4 +35,10 @@ struct Player {
luck: f32,
}
fn setup(mut commands: Commands) {}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
}
fn debug_our_king(mut commands: Commands, images: Res<ImageAssets>) {
commands.spawn(Sprite::from_image(images.king.clone()));
}