Skip to content

Commit

Permalink
add special attacks
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Feb 19, 2021
1 parent ecbb43c commit 3ed10bf
Show file tree
Hide file tree
Showing 45 changed files with 662 additions and 117 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ cargo run

* The Arrow Keys move the character around
* Z causes a short barrage of shots to be fired; it may be held down for rapidfire
* X releases a bomb, also known as a Spell Card (presuming that any are left)
* Esc pauses the game and brings you to the in-game menu
22 changes: 1 addition & 21 deletions assets/gfx/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"meta": {
"image": "bg.png",
"size": {
"w": 1536,
"w": 1024,
"h": 1024
},
"scale": "1"
Expand Down Expand Up @@ -47,26 +47,6 @@
"w": 512,
"h": 1024
}
},
"bg_grass.png": {
"frame": {
"x": 1024,
"y": 0,
"w": 512,
"h": 1024
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 512,
"h": 1024
},
"sourceSize": {
"w": 512,
"h": 1024
}
}
}
}
Binary file modified assets/gfx/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions assets/gfx/big_orbs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"meta": {
"image": "big_orbs.png",
"size": {
"w": 256,
"h": 64
},
"scale": "1"
},
"frames": {
"big_orb0.png": {
"frame": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"sourceSize": {
"w": 64,
"h": 64
}
},
"big_orb1.png": {
"frame": {
"x": 64,
"y": 0,
"w": 64,
"h": 64
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"sourceSize": {
"w": 64,
"h": 64
}
},
"big_orb2.png": {
"frame": {
"x": 128,
"y": 0,
"w": 64,
"h": 64
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"sourceSize": {
"w": 64,
"h": 64
}
},
"big_orb3.png": {
"frame": {
"x": 192,
"y": 0,
"w": 64,
"h": 64
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"sourceSize": {
"w": 64,
"h": 64
}
}
}
}
Binary file added assets/gfx/big_orbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions assets/gfx/special.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"meta": {
"image": "special.png",
"size": {
"w": 640,
"h": 488
},
"scale": "1"
},
"frames": {
"special0.png": {
"frame": {
"x": 0,
"y": 0,
"w": 320,
"h": 488
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 320,
"h": 488
},
"sourceSize": {
"w": 320,
"h": 488
}
},
"special1.png": {
"frame": {
"x": 320,
"y": 0,
"w": 320,
"h": 488
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 320,
"h": 488
},
"sourceSize": {
"w": 320,
"h": 488
}
}
}
}
Binary file added assets/gfx/special.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sfx/se_spell.ogg
Binary file not shown.
6 changes: 6 additions & 0 deletions common/src/game/player_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pub struct PlayerData<'a> {
pub sprite: &'a str,
pub bullet: &'a str,
pub special: &'a str,
pub big_orb: &'a str,
pub neutral_face: &'a str,
pub attack_face: &'a str,
pub dialog_face: &'a str,
Expand All @@ -14,6 +16,8 @@ impl<'a> PlayerData<'a> {
0 => Self {
sprite: "reimu0",
bullet: "spell0",
special: "special0",
big_orb: "big_orb0",
neutral_face: "a_reimu0",
attack_face: "a_reimu1",
damage_face: "a_reimu2",
Expand All @@ -36,6 +40,8 @@ impl<'a> PlayerData<'a> {
_ => Self {
sprite: "marisa0",
bullet: "spell4",
special: "special1",
big_orb: "big_orb1",
neutral_face: "a_marisa0",
attack_face: "a_marisa1",
damage_face: "a_marisa2",
Expand Down
2 changes: 1 addition & 1 deletion common/src/traits/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub trait Renderer {
alpha: u8,
);
fn draw_texture(&mut self, tex_name: &str, width: i32, height: i32);
fn draw_scrolling_bg(&mut self, sprite_name: &str, width: i32, height: i32);
fn draw_scrolling_bg(&mut self, sprite_name: &str, width: i32, height: i32, alpha: u8);
fn set_draw_color(&mut self, r: u8, g: u8, b: u8);
fn draw_vertical_separation(&mut self, width: i32, height: i32);
fn draw_rect(&mut self, pos: &Vector2D<i32>, width: i32, height: i32, color: RGBA);
Expand Down
5 changes: 3 additions & 2 deletions common/src/utils/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use crate::utils::math::*;

pub const SFX_VOLUME: f32 = 0.05;
pub const BGM_VOLUME: f32 = 0.1;
pub const CHANNEL_COUNT: u32 = 5;
pub const CHANNEL_COUNT: u32 = 6;
pub const CH_BG_MUSIC: u32 = 0;
pub const CH_SHOT: u32 = 1;
pub const CH_KILL: u32 = 2;
pub const CH_ITEM: u32 = 3;
pub const CH_DAMAGE: u32 = 4;
pub const CH_SPELL: u32 = 5;

pub const WINDOW_WIDTH: i32 = 700;
pub const WINDOW_HEIGHT: i32 = 256 * 2;
Expand Down Expand Up @@ -44,7 +45,6 @@ pub const ENE_SHOT_SPEED1: i32 = 25 * ONE / 10;
pub const ENE_SHOT_SPEED2: i32 = 40 * ONE / 10;

pub const BG1_TEXTURE: &str = "bg_ground";
pub const BG3_TEXTURE: &str = "bg_grass";
pub const BG2_TEXTURE: &str = "bg_water";

pub const BG_MUSIC: &str = "stage01";
Expand All @@ -56,6 +56,7 @@ pub const SE_OK: &str = "assets/sfx/se_ok00";
pub const SE_SELECT: &str = "assets/sfx/se_select00";
pub const SE_ITEM: &str = "assets/sfx/se_item00";
pub const SE_DAMAGE: &str = "assets/sfx/se_damage";
pub const SE_SPELL: &str = "assets/sfx/se_spell";

pub const RE_FONT: &str = "assets/fonts/regular.ttf";
pub const IM_FONT: &str = "assets/fonts/immortal.ttf";
3 changes: 3 additions & 0 deletions common/src/utils/pad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub enum Key {
Up,
Down,
Z,
X,
}

bitflags! {
Expand All @@ -20,6 +21,7 @@ bitflags! {
const D = 0b00001000;
const A = 0b00010000;
const Z = 0b00100000;
const X = 0b01000000;
}
}

Expand Down Expand Up @@ -63,6 +65,7 @@ fn get_key_bit(key: Key) -> PadBit {
Key::Up => PadBit::U,
Key::Down => PadBit::D,
Key::Z => PadBit::Z,
Key::X => PadBit::X,
Key::Space => PadBit::A,
_ => PadBit::empty(),
}
Expand Down
10 changes: 5 additions & 5 deletions docs/0.bootstrap.js

Large diffs are not rendered by default.

22 changes: 1 addition & 21 deletions docs/assets/gfx/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"meta": {
"image": "bg.png",
"size": {
"w": 1536,
"w": 1024,
"h": 1024
},
"scale": "1"
Expand Down Expand Up @@ -47,26 +47,6 @@
"w": 512,
"h": 1024
}
},
"bg_grass.png": {
"frame": {
"x": 1024,
"y": 0,
"w": 512,
"h": 1024
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 512,
"h": 1024
},
"sourceSize": {
"w": 512,
"h": 1024
}
}
}
}
Binary file modified docs/assets/gfx/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3ed10bf

Please sign in to comment.