diff --git a/src/bullet.rs b/src/bullet.rs index 72f02ab..47f6c83 100644 --- a/src/bullet.rs +++ b/src/bullet.rs @@ -1,6 +1,7 @@ -use crate::{enemy::death, layer, Armor, HitPoints, StatusEffect, StatusEffects, TaipoState}; use bevy::prelude::*; +use crate::{enemy::death, layer, Armor, HitPoints, StatusEffect, StatusEffects, TaipoState}; + pub struct BulletPlugin; impl Plugin for BulletPlugin { diff --git a/src/data.rs b/src/data.rs index cc199ab..b21b7cd 100644 --- a/src/data.rs +++ b/src/data.rs @@ -1,15 +1,15 @@ -use crate::{japanese_parser, TypingTarget}; - use bevy::{ asset::{AssetLoader, AssetPath, LoadContext, LoadedAsset}, prelude::*, reflect::{TypePath, TypeUuid}, utils::{BoxedFuture, HashMap}, }; -use bevy_common_assets::ron::RonAssetPlugin; +use bevy_common_assets::ron::RonAssetPlugin; use serde::Deserialize; +use crate::{japanese_parser, TypingTarget}; + // Tower stats, prices, etc should go in here eventually #[derive(Debug, Deserialize)] #[serde(rename = "GameData")] diff --git a/src/enemy.rs b/src/enemy.rs index e2f82e3..0605d1f 100644 --- a/src/enemy.rs +++ b/src/enemy.rs @@ -1,3 +1,7 @@ +use bevy::{ecs::query::Or, prelude::*}; + +use rand::{thread_rng, Rng}; + use crate::{ healthbar::HealthBar, layer, @@ -5,8 +9,6 @@ use crate::{ update_currency_text, ActionPanel, AfterUpdate, AnimationData, Armor, Currency, Goal, HitPoints, Speed, StatusDownSprite, StatusEffects, StatusUpSprite, TaipoState, }; -use bevy::{ecs::query::Or, prelude::*}; -use rand::{thread_rng, Rng}; pub struct EnemyPlugin; diff --git a/src/game_over.rs b/src/game_over.rs index 7bdcc48..db4be3b 100644 --- a/src/game_over.rs +++ b/src/game_over.rs @@ -1,9 +1,9 @@ +use bevy::prelude::*; + use crate::{ enemy::AnimationState, loading::FontHandles, ui_color, wave::Waves, AfterUpdate, Currency, Goal, HitPoints, TaipoState, FONT_SIZE, }; -use bevy::prelude::*; - pub struct GameOverPlugin; impl Plugin for GameOverPlugin { diff --git a/src/healthbar.rs b/src/healthbar.rs index 0357c5a..0fc2c10 100644 --- a/src/healthbar.rs +++ b/src/healthbar.rs @@ -1,6 +1,7 @@ -use crate::{layer, AfterUpdate, HitPoints, TaipoState}; use bevy::prelude::*; +use crate::{layer, AfterUpdate, HitPoints, TaipoState}; + pub struct HealthBarPlugin; impl Plugin for HealthBarPlugin { diff --git a/src/loading.rs b/src/loading.rs index 1ba57ce..4e01d41 100644 --- a/src/loading.rs +++ b/src/loading.rs @@ -1,7 +1,9 @@ -use crate::{data::AnimationData, map::TiledMap, GameData, TaipoState}; use bevy::prelude::*; + use bevy_asset_loader::prelude::*; +use crate::{data::AnimationData, map::TiledMap, GameData, TaipoState}; + pub struct LoadingPlugin; impl Plugin for LoadingPlugin { diff --git a/src/main.rs b/src/main.rs index 08f449c..b65b8a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,22 +9,20 @@ use bevy::{ utils::HashMap, window::PrimaryWindow, }; + use bevy_ecs_tilemap::TilemapPlugin; -use game_over::GameOverPlugin; -use loading::{FontHandles, LevelHandles, TextureHandles, UiTextureHandles}; -use reticle::{Reticle, ReticlePlugin}; -use typing::TypingTargetSettings; -use ui_color::TRANSPARENT_BACKGROUND; -use wave::{Wave, WavePlugin, WaveState, Waves}; +use tiled::{ObjectShape, PropertyValue}; use crate::{ bullet::BulletPlugin, data::{AnimationData, GameData, GameDataPlugin}, enemy::EnemyPlugin, + game_over::GameOverPlugin, healthbar::{HealthBar, HealthBarPlugin}, - loading::LoadingPlugin, + loading::{FontHandles, LevelHandles, LoadingPlugin, TextureHandles, UiTextureHandles}, main_menu::MainMenuPlugin, map::{TiledMap, TiledMapPlugin}, + reticle::{Reticle, ReticlePlugin}, tower::{ TowerBundle, TowerChangedEvent, TowerKind, TowerPlugin, TowerSprite, TowerState, TowerStats, TOWER_PRICE, @@ -32,12 +30,12 @@ use crate::{ typing::{ AsciiModeEvent, TypingPlugin, TypingTarget, TypingTargetBundle, TypingTargetContainer, TypingTargetFinishedEvent, TypingTargetImage, TypingTargetPriceContainer, - TypingTargetPriceText, TypingTargetText, TypingTargets, + TypingTargetPriceText, TypingTargetSettings, TypingTargetText, TypingTargets, }, + ui_color::TRANSPARENT_BACKGROUND, + wave::{Wave, WavePlugin, WaveState, Waves}, }; -use tiled::{ObjectShape, PropertyValue}; - extern crate anyhow; mod bullet; diff --git a/src/main_menu.rs b/src/main_menu.rs index 455b0be..6311b56 100644 --- a/src/main_menu.rs +++ b/src/main_menu.rs @@ -1,9 +1,9 @@ use bevy::prelude::*; + use rand::{prelude::SliceRandom, thread_rng}; use crate::{ - data::WordList, - data::WordListMenuItem, + data::{WordList, WordListMenuItem}, loading::{FontHandles, GameDataHandles, LevelHandles}, map::TiledMapBundle, typing::TypingTargets, diff --git a/src/map.rs b/src/map.rs index 9902d00..7f27334 100644 --- a/src/map.rs +++ b/src/map.rs @@ -3,6 +3,7 @@ use bevy::{ prelude::*, reflect::{TypePath, TypeUuid}, }; + use bevy_ecs_tilemap::prelude::*; use std::{collections::HashMap, io::BufReader}; @@ -159,12 +160,11 @@ pub fn process_loaded_maps( // tilesets on each layer and allows differently-sized tile images in each tileset, // this means we need to load each combination of tileset and layer separately. for (tileset_index, tileset) in tiled_map.map.tilesets().iter().enumerate() { - let Some(tilemap_texture) = tiled_map - .tilemap_textures - .get(&tileset_index) else { - warn!("Skipped creating layer with missing tilemap textures."); - continue; - }; + let Some(tilemap_texture) = tiled_map.tilemap_textures.get(&tileset_index) + else { + warn!("Skipped creating layer with missing tilemap textures."); + continue; + }; let tile_size = TilemapTileSize { x: tileset.tile_width as f32, diff --git a/src/tower.rs b/src/tower.rs index f2569d6..e193ed4 100644 --- a/src/tower.rs +++ b/src/tower.rs @@ -1,9 +1,11 @@ +use bevy::prelude::*; + use crate::{ bullet, enemy::EnemyKind, layer, typing_target_finished_event, AfterUpdate, HitPoints, RangeIndicator, StatusDownSprite, StatusEffect, StatusEffectKind, StatusEffects, StatusUpSprite, TaipoState, TextureHandles, TowerSelection, }; -use bevy::prelude::*; + pub struct TowerPlugin; impl Plugin for TowerPlugin { diff --git a/src/typing.rs b/src/typing.rs index cd91057..ab9f14d 100644 --- a/src/typing.rs +++ b/src/typing.rs @@ -3,13 +3,13 @@ use bevy::{ prelude::*, }; +use std::collections::VecDeque; + use crate::{ loading::AudioHandles, ui_color::TRANSPARENT_BACKGROUND, Action, AudioSettings, FontHandles, TaipoState, FONT_SIZE_INPUT, }; -use std::collections::VecDeque; - pub struct TypingPlugin; impl Plugin for TypingPlugin { diff --git a/src/wave.rs b/src/wave.rs index 5d7f4ce..b23aec6 100644 --- a/src/wave.rs +++ b/src/wave.rs @@ -1,5 +1,6 @@ -use anyhow::anyhow; use bevy::{prelude::*, utils::HashMap}; + +use anyhow::anyhow; use tiled::{Object, PropertyValue}; use crate::{