This commit is contained in:
Back777space
2025-04-06 00:04:50 +02:00
parent eeae924c8d
commit 4073a2675a
14 changed files with 23 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,5 +1,6 @@
({
"lebron": File (path: "images/KingLebron.png"),
"flash_hold_4": File (path: "images/pixelart/Flashlight_hold_4.png"),
"house": File (path: "meshes/House.glb"),
"library": Folder (
path: "meshes/library",

View File

@@ -14,6 +14,7 @@ pub(super) fn plugin(app: &mut App) {
.continue_to_state(GameState::Menu)
.with_dynamic_assets_file::<StandardDynamicAssetCollection>("main.assets.ron")
.load_collection::<ImageAssets>()
.load_collection::<FlashlightAssets>()
.load_collection::<GltfAssets>(),
// .load_collection::<AudioAssets>()
// .load_collection::<TextureAssets>()
@@ -50,3 +51,9 @@ pub(crate) struct ImageAssets {
#[asset(key = "lebron")]
pub(crate) king: Handle<Image>,
}
#[derive(AssetCollection, Resource, Clone)]
pub(crate) struct FlashlightAssets {
#[asset(key = "flash_hold_4")]
pub(crate) flash_hold_4: Handle<Image>,
}

View File

@@ -14,10 +14,10 @@ fn main() {
bevy_plugin::plugin,
asset_loading::plugin,
level_instantiation::map_plugin,
player::plugin,
main_menu::plugin,
RapierPhysicsPlugin::<NoUserData>::default(),
RapierDebugRenderPlugin::default(),
player::plugin,
))
.init_state::<GameState>()
.add_systems(OnEnter(GameState::Playing), setup)
@@ -35,19 +35,16 @@ enum GameState {
Menu,
}
fn debug_our_king(mut commands: Commands, images: Res<ImageAssets>) {
commands.spawn(Sprite::from_image(images.king.clone()));
}
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
image: Res<ImageAssets>
) {
// circular base
commands.spawn((
Mesh3d(meshes.add(Circle::new(4.0))),
MeshMaterial3d(materials.add(Color::WHITE)),
MeshMaterial3d(materials.add(image.king.clone())),
Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
));
commands.spawn((

View File

@@ -1,10 +1,10 @@
use bevy::{
input::mouse::AccumulatedMouseMotion, pbr::NotShadowCaster, prelude::*,
input::mouse::AccumulatedMouseMotion, prelude::*,
render::view::RenderLayers, window::PrimaryWindow,
};
use bevy_rapier3d::prelude::*;
use crate::GameState;
use crate::{asset_loading::{FlashlightAssets, ImageAssets}, GameState};
#[derive(Debug, Component)]
pub struct Player;
@@ -42,12 +42,9 @@ const STATIC_LAYER: usize = 1;
pub fn init_player(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
flashlights: Res<FlashlightAssets>,
images: Res<ImageAssets>,
) {
let arm = meshes.add(Cuboid::new(0.1, 0.1, 0.5));
let arm_material = materials.add(Color::WHITE);
commands
.spawn((
Player,
@@ -65,10 +62,6 @@ pub fn init_player(
},
Transform::from_xyz(0.0, 1.0, 0.0),
GlobalTransform::default(),
Visibility::default(),
InheritedVisibility::default(),
ViewVisibility::default(),
))
.with_children(|parent| {
parent.spawn((
@@ -78,11 +71,6 @@ pub fn init_player(
fov: 90.0_f32.to_radians(),
..default()
}),
Transform::default(),
GlobalTransform::default(),
Visibility::default(),
InheritedVisibility::default(),
ViewVisibility::default(),
));
// camera voor pitslampke
@@ -92,31 +80,21 @@ pub fn init_player(
order: 1,
..default()
},
Projection::from(PerspectiveProjection {
fov: 70.0_f32.to_radians(),
..default()
}),
RenderLayers::layer(STATIC_LAYER),
Transform::default(),
GlobalTransform::default(),
Visibility::default(),
InheritedVisibility::default(),
ViewVisibility::default(),
));
// pitslampke
parent.spawn((
Mesh3d(arm),
MeshMaterial3d(arm_material),
Transform::from_xyz(0.2, -0.1, -0.25),
GlobalTransform::default(),
Transform::from_xyz(-3.0, -3.0, 0.0),
Sprite {
image: images.king.clone(),
..default()
},
RenderLayers::layer(STATIC_LAYER),
NotShadowCaster,
Visibility::default(),
InheritedVisibility::default(),
ViewVisibility::default(),
));
});
commands.spawn(Sprite::from_image(images.king.clone()));
}
fn hide_cursor(mut windows: Query<&mut Window, With<PrimaryWindow>>) {