Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.11 update, remove scripting. #304

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,073 changes: 1,625 additions & 2,448 deletions Cargo.lock

Large diffs are not rendered by default.

72 changes: 35 additions & 37 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,62 +1,60 @@
[package]
authors = ["The Fish Folk Game & Spicy Lobster Developers"]
authors = ["The Fish Folk Game & Spicy Lobster Developers"]
description = "A 2.5D side-scroller beatemup"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "punchy"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "punchy"
version = "0.1.0"

[workspace]
members = [".", "macros"]

[dependencies.bevy]
default-features = false
features = ["x11", "png", "filesystem_watcher", "bevy_gilrs"]
version = "0.9"
features = ["x11", "png", "filesystem_watcher", "bevy_gilrs"]
version = "0.11.0"

[dependencies]
punchy_macros = { path = "./macros" }

anyhow = "1.0.58"
bevy-parallax = "0.3.0"
bevy_egui = "0.18.0"
bevy_kira_audio = { version = "0.13.0", features = ["mp3"] }
bevy_rapier2d = { version = "0.20.0", features = ["debug-render-2d"] }
egui_extras = "0.20.0"
getrandom = { version = "0.2", features = ["js"] }
iyes_loopless = { version = "0.9.0", features = ["states"] }
rand = "0.8.5"
serde = { version = "1.0.137", features = ["derive"] }
serde_yaml = "0.9.2"
structopt = "0.3.26"
thiserror = "1.0.31"
bevy-parallax = "0.6.1"
anyhow = "1.0.72"
bevy_egui = "0.21.0"
bevy_kira_audio = { version = "0.16.0", features = ["mp3"] }
bevy_rapier2d = { version = "0.22.0", features = ["debug-render-2d"] }
egui_extras = "0.22.0"
getrandom = { version = "0.2", features = ["js"] }
rand = "0.8.5"
serde = { version = "1.0.180", features = ["derive"] }
serde_yaml = "0.9.2"
structopt = "0.3.26"
thiserror = "1.0.44"

async-channel = "1.6.1"
bevy_fluent = "0.5.0"
bevy_mod_js_scripting = { git = "https://github.com/jakobhellermann/bevy_mod_js_scripting.git" }
directories = "4.0.1"
fluent = "0.16.0"
fluent_content = "0.0.3"
leafwing-input-manager = { version = "0.7", default-features = false }
once_cell = "1.13.0"
sys-locale = "0.2.1"
unic-langid = "0.9.0"
async-channel = "1.9.0"
bevy_fluent = "0.7.0"
directories = "5.0.1"
fluent = "0.16.0"
fluent_content = "0.0.5"
leafwing-input-manager = { version = "0.10", default-features = false }
once_cell = "1.13.0"
sys-locale = "0.3.0"
unic-langid = "0.9.0"

# Debug tools
bevy-inspector-egui = { version = "0.15.0" }
bevy-inspector-egui-rapier = { version = "0.9.0", features = ["rapier2d"] }
bevy_mod_debugdump = { version = "0.6.0", optional = true }
bevy-inspector-egui = { version = "0.19.0" }
# bevy-inspector-egui-rapier = { version = "0.9.0", features = ["rapier2d"] }
bevy_mod_debugdump = { version = "0.8.0", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features = ["Window", "Location", "Storage"] }

[features]
default = []
default = []
schedule_graph = ["bevy_mod_debugdump"]

# Enable optimizations for dependencies but not for our code
[profile.dev.package."*"]
debug = false
debug = false
opt-level = 3

[profile.dev]
Expand All @@ -69,5 +67,5 @@ opt-level = 3
# slower than opt-level=0.

[profile.release]
codegen-units = 1 # Improves physics performance for release builds
lto = true
codegen-units = 1 # Improves physics performance for release builds
lto = true
13 changes: 7 additions & 6 deletions assets/default.game.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ camera_height: 448
# For simplicity, this value can also be used for movement limitation calculations.
camera_move_right_boundary: 150.

scripts:
# Enable our demo script
# - scripts/demo_script.ts

main_menu:
title_font:
family: ark
Expand All @@ -34,21 +30,26 @@ default_settings:
axis_type: !Gamepad LeftStickY
positive_low: 0.1
negative_low: -1.0
inverted: false

left: !SingleAxis
axis_type: !Gamepad LeftStickX
positive_low: 1.0
negative_low: -0.1
inverted: false

down: !SingleAxis
axis_type: !Gamepad LeftStickY
positive_low: 1.0
negative_low: -0.1
inverted: false

right: !SingleAxis
axis_type: !Gamepad LeftStickX
positive_low: 0.1
negative_low: -1.0
inverted: false

flop_attack: !GamepadButton South
shoot: !GamepadButton East
throw: !GamepadButton West
Expand All @@ -72,7 +73,7 @@ default_settings:
left: !Keyboard Left
right: !Keyboard Right
flop_attack: !Keyboard Comma
shoot: !Keyboard RShift
shoot: !Keyboard ShiftRight
throw: !Keyboard Period

ui_theme:
Expand Down Expand Up @@ -227,4 +228,4 @@ translations:
default_locale: en-US
locales:
- locales/en-US/en-US.ftl.yml
- locales/fr-FR/fr-FR.ftl.yml
- locales/fr-FR/fr-FR.ftl.yml
23 changes: 9 additions & 14 deletions assets/levels/1_beach/beach.level.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,34 @@ parallax_background:
rows: 1
z: 0
scale: 0.9
transition_factor: 0.9
- speed: 0.9
path: background_02.2.png
tile_size: [960, 540]
cols: 1
rows: 1
z: 1
scale: 0.9
transition_factor: 0.9
- speed: 0.82
path: background_03.png
tile_size: [960, 540]
cols: 1
rows: 1
z: 2
scale: 0.9
transition_factor: 0.9
- speed: 0.74
path: background_04.2.png
tile_size: [960, 540]
cols: 1
rows: 1
z: 3
scale: 0.9
transition_factor: 0.9
- speed: 0
path: background_05.2.png
tile_size: [960, 540]
cols: 1
rows: 1
z: 4
scale: 0.9
transition_factor: 0.9

players:
# - fighter: /fighters/fishy/fishy.fighter.yaml
Expand Down Expand Up @@ -87,19 +82,19 @@ enemies:
stop_points: [500, 1000]

items:
- item: &health /items/health/health.item.yaml
location: [50, -70, 0]
# - item: &health /items/health/health.item.yaml
# location: [50, -70, 0]
- item: &bottle /items/bottle/bottle.item.yaml
location: [100, -20, 0]
- item: &fishfood /items/fishfood/fishfood.item.yaml
location: [100, -70, 0]
- item: &pellets /items/pellets/pellets.item.yaml
location: [200, -70, 0]
- item: &poison /items/poison/poison.item.yaml
location: [100, -50, 0]
# - item: &fishfood /items/fishfood/fishfood.item.yaml
# location: [100, -70, 0]
# - item: &pellets /items/pellets/pellets.item.yaml
# location: [200, -70, 0]
# - item: &poison /items/poison/poison.item.yaml
# location: [100, -50, 0]
- item: &sword /items/sword/sword.item.yaml
location: [-100, -20, 0]
- item: &box /items/box/box.item.yaml
location: [30, 60, 0]
- item: &musket /items/musket/musket.item.yaml
location: [-20, -20, 0]
location: [-20, -20, 0]
22 changes: 13 additions & 9 deletions src/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bevy::{
time::{Time, Timer},
utils::HashMap,
};
use iyes_loopless::condition::ConditionSet;
// use iyes_loopless::condition::ConditionSet;
use serde::{de::SeqAccess, Deserializer};

pub struct AnimationPlugin;
Expand All @@ -18,21 +18,25 @@ impl Plugin for AnimationPlugin {
// Register reflect types
.register_type::<Facing>()
// Add systems
.add_system_set_to_stage(
CoreStage::Last,
ConditionSet::new()
.run_in_state(GameState::InGame)
.with_system(animation_flipping)
.with_system(animation_cycling)
.into(),
// should probably be postupdate?
.add_systems(
Last,
(animation_flipping, animation_cycling).run_if(in_state(GameState::InGame)),
);
// .add_system_set_to_stage(
// CoreStage::Last,
// ConditionSet::new()
// .run_in_state(GameState::InGame)
// .with_system(animation_flipping)
// .with_system(animation_cycling)
// .into(),
// );
}
}

/// Bundle for animated sprite sheets
#[derive(Bundle, Clone)]
pub struct AnimatedSpriteSheetBundle {
#[bundle]
pub sprite_sheet: SpriteSheetBundle,
pub animation: Animation,
}
Expand Down
36 changes: 18 additions & 18 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy::{
asset::{Asset, AssetLoader, AssetPath, LoadedAsset},
prelude::AddAsset,
prelude::*,
reflect::TypeUuid,
reflect::{TypePath, TypeUuid},
utils::HashMap,
};
use bevy_egui::egui;
Expand Down Expand Up @@ -155,13 +155,13 @@ impl AssetLoader for GameMetaLoader {
.insert(font_name.clone(), font_handle);
}

// Load the script handles
for script_relative_path in &meta.scripts {
let (script_path, script_handle) =
get_relative_asset(load_context, &self_path, script_relative_path);
dependencies.push(script_path);
meta.script_handles.push(script_handle);
}
// // Load the script handles
// for script_relative_path in &meta.scripts {
// let (script_path, script_handle) =
// get_relative_asset(load_context, &self_path, script_relative_path);
// dependencies.push(script_path);
// meta.script_handles.push(script_handle);
// }

load_context.set_default_asset(LoadedAsset::new(meta).with_dependencies(dependencies));

Expand Down Expand Up @@ -432,15 +432,15 @@ impl AssetLoader for ItemLoader {
spritesheet.atlas_handle.push(atlas_handle);
}
}
ItemKind::Script {
script,
ref mut script_handle,
} => {
let (script_path, loaded_script_handle) =
get_relative_asset(load_context, load_context.path(), script);
dependencies.push(script_path);
*script_handle = loaded_script_handle;
}
// ItemKind::Script {
// script,
// ref mut script_handle,
// } => {
// let (script_path, loaded_script_handle) =
// get_relative_asset(load_context, load_context.path(), script);
// dependencies.push(script_path);
// *script_handle = loaded_script_handle;
// }
ItemKind::Bomb { spritesheet, .. } => {
for (index, image) in spritesheet.image.iter().enumerate() {
let (texture_path, texture_handle) =
Expand Down Expand Up @@ -475,7 +475,7 @@ impl AssetLoader for ItemLoader {
}
}

#[derive(Debug, Clone, TypeUuid)]
#[derive(Debug, Clone, TypeUuid, TypePath)]
#[uuid = "da277340-574f-4069-907c-7571b8756200"]
pub struct EguiFont(pub egui::FontData);

Expand Down
30 changes: 13 additions & 17 deletions src/attack.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use std::time::Duration;

use bevy::{
hierarchy::DespawnRecursiveExt,
math::Vec2,
prelude::*,
reflect::{FromReflect, Reflect},
};
use bevy::{hierarchy::DespawnRecursiveExt, math::Vec2, prelude::*, reflect::Reflect};
use bevy_rapier2d::prelude::*;
use iyes_loopless::prelude::*;

use serde::Deserialize;

Expand All @@ -30,17 +24,18 @@ impl Plugin for AttackPlugin {
// Register reflect types
.register_type::<Attack>()
// Add systems
.add_system_set(
ConditionSet::new()
.run_in_state(GameState::InGame)
.with_system(activate_hitbox)
.with_system(deactivate_hitbox)
.with_system(breakable_system)
.with_system(damage_flash)
.into(),
.add_systems(
Update,
(
activate_hitbox,
deactivate_hitbox,
breakable_system,
damage_flash,
)
.run_if(in_state(GameState::InGame)),
)
// Attack damage is run in PostUpdate to make sure it runs after rapier generates collision events
.add_system_to_stage(CoreStage::PostUpdate, attack_damage_system)
.add_systems(PostUpdate, attack_damage_system)
// Event for when Breakable breaks
.add_event::<BrokeEvent>();
}
Expand Down Expand Up @@ -89,6 +84,7 @@ impl Breakable {
}
}

#[derive(Event)]
pub struct BrokeEvent {
pub drop: Option<Drop>,
pub transform: Option<Transform>,
Expand All @@ -100,7 +96,7 @@ pub struct BrokeEvent {
/// Must be added to an entity that is a child of an entity with an [`Animation`] and an [`Attack`]
/// and will be used to spawn a collider for that attack during the `active` frames.
/// Each field is an index refering to an animation frame
#[derive(Component, Debug, Clone, Copy, Deserialize, Reflect, FromReflect)]
#[derive(Component, Debug, Clone, Copy, Deserialize, Reflect)]
pub struct AttackFrames {
pub startup: usize,
pub active: usize,
Expand Down
Loading
Loading