@@ -5,11 +5,11 @@ use crate::{
55 assets:: { HandleMap , ImageKey , SfxKey } ,
66 audio:: sfx:: { PlayLoopingSfx , PlaySfx , StopLoopingSfx } ,
77 } ,
8- screen:: Screen ,
8+ screen:: { PlayingState , Screen } ,
99 AppSet ,
1010} ;
1111
12- use super :: level:: Score ;
12+ use super :: level:: { Score , Scoresource } ;
1313
1414pub ( super ) fn plugin ( app : & mut App ) {
1515 app. observe ( spawn_interact_clock) ;
@@ -19,19 +19,22 @@ pub(super) fn plugin(app: &mut App) {
1919 ( tick_clocks, score_clocks)
2020 . chain ( )
2121 . in_set ( AppSet :: FixedUpdate )
22- . run_if ( in_state ( Screen :: Playing ) ) ,
22+ . run_if ( in_state ( Screen :: Playing ) )
23+ . run_if ( in_state ( PlayingState :: Playing ) ) ,
2324 ) ;
2425 app. add_systems (
2526 Update ,
2627 record_clock_controller
2728 . in_set ( AppSet :: RecordInput )
28- . run_if ( in_state ( Screen :: Playing ) ) ,
29+ . run_if ( in_state ( Screen :: Playing ) )
30+ . run_if ( in_state ( PlayingState :: Playing ) ) ,
2931 ) ;
3032 app. add_systems (
3133 FixedUpdate ,
3234 apply_clock_control
3335 . in_set ( AppSet :: Update )
34- . run_if ( in_state ( Screen :: Playing ) ) ,
36+ . run_if ( in_state ( Screen :: Playing ) )
37+ . run_if ( in_state ( PlayingState :: Playing ) ) ,
3538 ) ;
3639 app. insert_resource ( Positions {
3740 clock_spawn : Vec2 :: new ( -550.0 , -185.0 ) ,
@@ -299,6 +302,7 @@ fn score_clocks(
299302 mut score : Query < ( & mut Score , & mut Text ) > ,
300303 clocks : Query < ( & Clock , & Children ) > ,
301304 clock_children : Query < ( & Transform , & ClockHandType ) > ,
305+ mut scoresource : ResMut < Scoresource > ,
302306) {
303307 let main = clocks. iter ( ) . find ( |( clock, _) | clock. is_main ) . unwrap ( ) ;
304308 let main_rotations = get_clock_rotations ( main. 1 , & clock_children) ;
@@ -352,6 +356,7 @@ fn score_clocks(
352356 _ => { }
353357 }
354358 text. sections [ 0 ] . value = format ! ( "{:.0}" , score. 0 ) ;
359+ scoresource. 0 = score. 0 ;
355360}
356361
357362struct ClockRotations {
@@ -511,7 +516,7 @@ fn spawn_interact_clock(
511516 SpriteBundle {
512517 texture : image_handles[ & ImageKey :: ClockMinute ] . clone_weak ( ) ,
513518 transform : Transform {
514- translation : Vec3 :: new ( 0.0 , 0.0 , 400 .0) ,
519+ translation : Vec3 :: new ( 0.0 , 0.0 , 350 .0) ,
515520 ..default ( )
516521 } ,
517522 sprite : Sprite {
0 commit comments