some more fixes
This commit is contained in:
parent
a81f9fa8ac
commit
c1e53bdab0
9 changed files with 34 additions and 20 deletions
|
|
@ -73,7 +73,7 @@ fn setup_game(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
commands.entity(root).add_child(menu_root);
|
||||
|
||||
//бэкграунд
|
||||
let bg: Handle<Image> = asset_server.load("bg/game.png");
|
||||
let bg: Handle<Image> = asset_server.load("sprites/bg/game.png");
|
||||
let bg_entity = spawn_background(&mut commands, bg, GameStateRootMarker);
|
||||
|
||||
let mm_button_style = ButtonStyle {
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ pub enum BallType {
|
|||
impl BallType {
|
||||
pub const fn asset_path(&self) -> &'static str {
|
||||
match self {
|
||||
BallType::First => "balls/1.png",
|
||||
BallType::Second => "balls/2.png",
|
||||
BallType::Third => "balls/3.png",
|
||||
BallType::Forth => "balls/4.png",
|
||||
BallType::First => "sprites/balls/1.png",
|
||||
BallType::Second => "sprites/balls/2.png",
|
||||
BallType::Third => "sprites/balls/3.png",
|
||||
BallType::Forth => "sprites/balls/4.png",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ pub fn check_wave_completion(
|
|||
}
|
||||
|
||||
// проверка на количество поинтов для победы
|
||||
if score.0 == POINTS_TO_WIN {
|
||||
if score.0 >= POINTS_TO_WIN {
|
||||
game_win.0 = true;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use bevy::window::PrimaryWindow;
|
|||
use std::collections::HashSet;
|
||||
|
||||
pub fn setup_cannon(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
let texture: Handle<Image> = asset_server.load("cannon/cannon.png");
|
||||
let texture: Handle<Image> = asset_server.load("sprites/cannon/cannon.png");
|
||||
|
||||
commands.spawn((
|
||||
LevelMarker,
|
||||
|
|
@ -133,7 +133,13 @@ pub fn update_cannon_preview(
|
|||
|
||||
if let Ok(muzzle_entity) = muzzle_query.single() {
|
||||
// усли шарик у дула есть, то обновляем спрайт
|
||||
commands.entity(muzzle_entity).insert(Sprite::from_image(muzzle_image));
|
||||
commands.entity(muzzle_entity).insert(
|
||||
Sprite{
|
||||
image: muzzle_image,
|
||||
custom_size: Some(Vec2::splat(SLOT_SIZE)),
|
||||
..default()
|
||||
}
|
||||
);
|
||||
} else {
|
||||
//иначе создаем
|
||||
let preview_entity = commands.spawn((
|
||||
|
|
@ -153,7 +159,11 @@ pub fn update_cannon_preview(
|
|||
let next_image = asset_server.load(cannon_state.next_type.asset_path());
|
||||
|
||||
if let Ok(next_entity) = next_query.single() {
|
||||
commands.entity(next_entity).insert(Sprite::from_image(next_image));
|
||||
commands.entity(next_entity).insert(Sprite{
|
||||
image: next_image,
|
||||
custom_size: Some(Vec2::splat(SLOT_SIZE)),
|
||||
..default()
|
||||
});
|
||||
} else {
|
||||
let preview_entity = commands.spawn((
|
||||
NextPreviewMarker,
|
||||
|
|
@ -236,6 +246,8 @@ pub fn detect_projectile_hit(
|
|||
}
|
||||
|
||||
// проверяем попадание
|
||||
// FIXME из-за рассинхрона прогресса и индекса иногда шарик-снаряд
|
||||
// пролетает насквозь визуально через другой шарик
|
||||
let hit = match HITBOX_TYPE {
|
||||
HitboxType::Circle => {
|
||||
min_dist < HIT_THRESHOLD
|
||||
|
|
@ -279,6 +291,7 @@ pub fn detect_projectile_hit(
|
|||
|
||||
// ищем конец непрерывной очереди начиная с insert_idx
|
||||
// строим набор занятых индексов (обязательно до вставки)
|
||||
// FIXME если оторванных групп больше одной, то слияние очереди нарушается в механике, хотя визуально все ок
|
||||
let occupied: HashSet<usize> = balls.iter()
|
||||
.map(|(_, b)| b.slot_index)
|
||||
.collect();
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ pub fn setup_track_with_buffer() -> TrackPath {
|
|||
|
||||
// for debug
|
||||
fn make_track() -> Vec<Vec2> {
|
||||
// make_track_40()
|
||||
make_track_80()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ fn setup_main_menu(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
commands.entity(root).add_child(menu_root);
|
||||
|
||||
//бэкграунд
|
||||
let bg: Handle<Image> = asset_server.load("bg/main_menu.png");
|
||||
let bg: Handle<Image> = asset_server.load("sprites/bg/main_menu.png");
|
||||
spawn_background(&mut commands, bg, MainMenuRootMarker);
|
||||
|
||||
//задаем стиль кнопкам главного меню
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ fn setup_settings_menu(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
))
|
||||
.id();
|
||||
|
||||
let bg: Handle<Image> = asset_server.load("bg/settings.png");
|
||||
let bg: Handle<Image> = asset_server.load("sprites/bg/settings.png");
|
||||
spawn_background(&mut commands, bg, SettingsRootMarker);
|
||||
|
||||
let mm_button_style = ButtonStyle {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue