clicking through animations/intro scroll

main
Elijah C. Voigt 2 years ago
parent ca95bf46ec
commit bd303af745

@ -84,7 +84,7 @@ impl Plugin for Display3dPlugin {
setup_capture_piece.run_if(any_component_changed::<Handle<StandardMaterial>>()),
capture_piece.run_if(any_with_component::<game::Captured>()),
skip_animation
.run_if(just_pressed(KeyCode::Return))
.run_if(just_pressed(KeyCode::Return).or_else(just_pressed(MouseButton::Left)))
.run_if(in_state(GameState::Play)),
),
)

@ -24,7 +24,8 @@ impl Plugin for IntroPlugin {
// Updated for as long as there is scrolling text
manage_scroll_text_animation.run_if(
any_component_added::<ui::TextScrollAnimation>()
.or_else(just_pressed(KeyCode::Return)),
.or_else(just_pressed(KeyCode::Return))
.or_else(just_pressed(MouseButton::Left)),
),
// Play intro manages playing the intro of each individual paragraph
// Runs every time the TextScroll component (managed by manage_scroll_text_animation) is updated
@ -239,6 +240,7 @@ fn scroll_text(
tweaks: Res<Assets<tweak::Tweaks>>,
time: Res<Time>,
keys: Res<Input<KeyCode>>,
mouse: Res<Input<MouseButton>>,
parents: Query<&Parent>,
mut commands: Commands,
) {
@ -258,17 +260,18 @@ fn scroll_text(
}
// If user pressed enter, skip to end of paragraph
text_scroll.progress = if keys.just_pressed(KeyCode::Return) {
usize::MAX
}
// Otherwise, progress by some fixed increment
else {
// Update animation progress for this paragrpah
let delay = tweak.get::<f32>("intro_delay").unwrap();
text_scroll.progress =
if keys.just_pressed(KeyCode::Return) || mouse.just_pressed(MouseButton::Left) {
usize::MAX
}
// Otherwise, progress by some fixed increment
else {
// Update animation progress for this paragrpah
let delay = tweak.get::<f32>("intro_delay").unwrap();
// Update text_scroll.progress based on frame count
((time.elapsed_seconds() - text_scroll.start) / delay) as usize
};
// Update text_scroll.progress based on frame count
((time.elapsed_seconds() - text_scroll.start) / delay) as usize
};
// Fetch desired color from tweakfile
let text_visible_hex = tweak.get::<String>("intro_rgba_visible").unwrap();

@ -27,7 +27,10 @@ impl Plugin for TutorialPlugin {
// A piece is de-selected
.or_else(any_component_removed::<game::Selected>())
// TEMP: The user hits 'enter'
.or_else(just_pressed(KeyCode::Return)),
.or_else(
just_pressed(KeyCode::Return)
.or_else(just_pressed(MouseButton::Left)),
),
),
),
),

Loading…
Cancel
Save