lebron
BIN
assets/images/pixelart/Flashlight_click_0.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_click_1.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/images/pixelart/Flashlight_click_2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_click_3.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_click_4.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_hold_0.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_hold_1.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_hold_2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_hold_3.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/pixelart/Flashlight_hold_4.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
@@ -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",
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
|
||||
@@ -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((
|
||||
|
||||
@@ -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>>) {
|
||||
|
||||