Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit367ae4c

Browse files
committed
first approach to skein provided collision detection
1 parent2f790b5 commit367ae4c

File tree

10 files changed

+80
-37
lines changed

10 files changed

+80
-37
lines changed

‎Cargo.lock‎

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎README.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ This template is based on the awesome [BevyFlock 2D template][BevyFlock] featuri
2525
- macOS
2626
- Web (Wasm)
2727
This template is a great way to get started if you aim to build new 3D RPG[Bevy] game!
28-
It is not as simple as bevy_new_2d which is aimed to an easy start. It focuses to have a rather solid structure to be able to carry the weight of big projects and tries to follow the[flat architercture](#project-structure) principle.
28+
It is not as simple as bevy_new_2d which is aimed to an easy start and no dependencies.
29+
It focuses instead to a rather solid starting template with some basic bells and whistles to be able to carry the weight of big projects and tries to follow the[flat architercture](#project-structure) principle.
2930
Start with a[basic project](#write-your-game) and[CI / CD](#release-your-game) that can deploy to[itch.io](https://itch.io).
3031
You can[try this template in your browser!](https://olekspickle.itch.io/bevy-3d-rpg)
3132

@@ -64,15 +65,15 @@ If you want to use serving with hotpatching, you can use dioxus-cli:
6465
-[ ] add basic mood change per zone
6566
-[ ] implement different music states(exploration, combat)
6667
-[ ] custom font replace example using pre-loaded font
68+
-[ ] Movement sfx sounds: jump, dash, sprint
6769
-[ ] sky background instead of just void lol
68-
-[ ] Movement sfx: jump, dash, sprint
6970
-[ ] spatial audio demo: boombox emitting background music
7071
-[ ] Jump with timer(tricky with tnua jump in air counter)
7172
-[ ] small door/portal demo
7273
-[ ] split screen for coop
7374
-[ ] vault on objects if they are reachable
7475
-[ ] climbing
75-
-[ ] do not rotate player on aim(silly bug,check it out -release aim looking to the floor)
76+
-[ ] do not rotate player on aim(silly bug,if yourelease aim looking to the floor - player model left rotated parallel to the floor)
7677
-[ ] basic fighting: punch, kick, take weapon
7778
-[ ] weapon select wheel
7879
-[ ] bow
@@ -106,19 +107,19 @@ There are some helpful commands in [Makefile](./Makefile) to simplify build opti
106107
But generally running your game locally is very simple:
107108

108109
<details>
109-
<summary><ins>Bevy CLI</ins></summary>
110+
<summary><ins>with bevy_cli</ins></summary>
110111

111-
- Dev: `bevy run` to run a native dev build
112-
- Release: `bevy run --release` to run a native release build
112+
- Dev:`bevy run` to run a native dev build
113+
- Release:`bevy run --release` to run a native release build
113114
- Use`bevy run --release web` to run a web release build
114115
To run a**web** dev build to run audio in separate thread to avoid audio stuttering:
115116
- :`bash bevy run web --headers="Cross-Origin-Opener-Policy:same-origin" --headers="Cross-Origin-Embedder-Policy:credentialless"`
116117
</details>
117118

118119
<details>
119-
<summary><ins>CMake</ins></summary>
120+
<summary><ins>with cmake</ins></summary>
120121

121-
- Dev: `make run` to run a **native** dev build
122+
- Dev:`make run` to run a**native** dev build
122123
- Release:`make build` to build a**native** release build
123124
- Web:`make run-web` to run a**web** dev build to run audio in separate thread to avoid audio stuttering
124125
</details>

‎assets/models/scene.blend‎

366 KB
Binary file not shown.

‎assets/models/scene.glb‎

464 KB
Binary file not shown.

‎src/game/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
usecrate::*;
2+
use avian3d::prelude::*;
23
use bevy_seedling::prelude::*;
34

45
mod camera;

‎src/game/mood.rs‎

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
//! An abstraction for changing mood of the game depending on some triggers
22
usesuper::*;
3+
use bevy::ecs::{component::ComponentId, observer::TriggerTargets};
34
use rand::prelude::*;
45

5-
//const FADE_TIME: f32 = 2.0;
6+
constFADE_TIME:f32 =2.0;
67

78
pubfnplugin(app:&mutApp){
89
app.add_systems(OnExit(Screen::Gameplay), stop_soundtrack)
910
.add_systems(OnEnter(Screen::Gameplay), start_soundtrack)
10-
// .add_systems(
11-
// Update,
12-
// (fade_in, fade_out).run_if(in_state(Screen::Gameplay)),
13-
// )
11+
.add_systems(
12+
Update,
13+
trigger_mood_change.run_if(in_state(Screen::Gameplay)),// (fade_in, fade_out)
14+
)
15+
// .add_observer(trigger_mood_change)
1416
.add_observer(change_mood);
1517
}
1618

@@ -49,12 +51,43 @@ fn stop_soundtrack(
4951
}
5052
}
5153

54+
// fn check_sensor_collision(mut collision_query: Query<(&CollidingEntities, &Sensor), With<Player>>) {
55+
// for (colliding_entities, sensor) in collision_query.iter() {
56+
// if !colliding_entities.is_empty() {
57+
// println!("hello");
58+
// }
59+
// }
60+
// }
61+
fntrigger_mood_change(
62+
// on: Trigger<CollisionStarted>,
63+
mutcommands:Commands,
64+
mutzones:Query<Entity,With<Zone>>,
65+
mutplayer:Query<Entity,With<Player>>,
66+
collisions:Collisions,
67+
){
68+
letOk(player) = player.single_mut()else{
69+
return;
70+
};
71+
for zonein zones.iter(){
72+
if collisions.contains(player, zone){
73+
let ids:Vec<ComponentId> = zone.components().collect();
74+
info!("components:{ids:?}");
75+
// let zone = commands.entity(zone);
76+
// if
77+
info!("sensors: player:{player}, zone:{zone}");
78+
}
79+
}
80+
// for zone in zones.iter() {}
81+
// info!("is_player a:{}, b:{}", commands.entity(a));
82+
}
83+
5284
// Every time the GameState resource changes, this system is run to trigger the song change.
5385
fnchange_mood(
5486
on:Trigger<ChangeMood>,
5587
settings:Res<Settings>,
5688
sources:Res<AudioSources>,
5789
mutstate:ResMut<GameState>,
90+
mutcollisions:Query<(&Zone,&Sensor),With<Player>>,
5891
music:Query<Entity,With<SamplerPool<Music>>>,
5992
mutcommands:Commands,
6093
){

‎src/models/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ pub use settings::*;
2626
pubuse states::*;
2727

2828
pubfnplugin(app:&mutApp){
29+
// register for skein
2930
app.add_plugins((
31+
primitives::plugin,
3032
settings::plugin,
3133
states::plugin,
3234
input::plugin,

‎src/models/primitives.rs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
usesuper::*;
22

3+
pubfnplugin(app:&mutApp){
4+
// register for skein
5+
app.register_type::<Zone>()
6+
.register_type::<Combat>()
7+
.register_type::<Exploration>();
8+
}
9+
310
/// Macro to hide the derive trait boilerplate
411
macro_rules! markers{
512
( $( $name:ident),*) =>{
@@ -16,8 +23,9 @@ markers!(
1623
// scene
1724
Sun,
1825
Moon,
19-
// Combat,
20-
// Exploration,
26+
Zone,
27+
Combat,
28+
Exploration,
2129
// TODO: The idea is to create a boombox with spatial audio
2230
// <https://github.com/bevyengine/bevy/blob/main/examples/audio/spatial_audio_3d.rs>
2331
// Boombox,

‎src/screens/gameplay.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
usesuper::*;
44

55
pub(super)fnplugin(app:&mutApp){
6-
app
7-
.add_systems(OnEnter(Screen::Gameplay), spawn_gameplay_ui)
6+
app.add_systems(OnEnter(Screen::Gameplay), spawn_gameplay_ui)
87
.add_observer(toggle_mute)
98
.add_observer(toggle_pause)
109
.add_observer(trigger_menu_toggle_on_esc)

‎src/ui/prefabs/settings.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ fn update_music_volume_label(
183183
settings:Res<Settings>,
184184
mutlabel:Single<&mutText,With<MusicVolumeLabel>>,
185185
){
186-
info!("music volume: {}", settings.sound.music);
187186
let percent =(settings.sound.music*100.0).round();
188187
let text =format!("{percent: <3}%");// pad the percent to 3 chars
189188
label.0 = text;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp