diff --git a/dist/shattered_sword_assets/sounds/die.wav b/dist/shattered_sword_assets/sounds/die.wav new file mode 100644 index 0000000..fe7e8da Binary files /dev/null and b/dist/shattered_sword_assets/sounds/die.wav differ diff --git a/dist/shattered_sword_assets/sounds/hurt.wav b/dist/shattered_sword_assets/sounds/hurt.wav new file mode 100644 index 0000000..fe2cb58 Binary files /dev/null and b/dist/shattered_sword_assets/sounds/hurt.wav differ diff --git a/dist/shattered_sword_assets/sounds/jump.wav b/dist/shattered_sword_assets/sounds/jump.wav new file mode 100644 index 0000000..949997e Binary files /dev/null and b/dist/shattered_sword_assets/sounds/jump.wav differ diff --git a/dist/shattered_sword_assets/sounds/jump2.wav b/dist/shattered_sword_assets/sounds/jump2.wav new file mode 100644 index 0000000..8212788 Binary files /dev/null and b/dist/shattered_sword_assets/sounds/jump2.wav differ diff --git a/dist/shattered_sword_assets/spritesheets/Hiro.json b/dist/shattered_sword_assets/spritesheets/Hiro.json index 28bfc5a..3a09703 100644 --- a/dist/shattered_sword_assets/spritesheets/Hiro.json +++ b/dist/shattered_sword_assets/spritesheets/Hiro.json @@ -13,11 +13,11 @@ "frames": [ { "index": 0, - "duration": 150 + "duration": 10 }, { "index": 1, - "duration": 150 + "duration": 10 } ] }, @@ -27,35 +27,35 @@ "frames": [ { "index": 4, - "duration": 150 + "duration": 5 }, { "index": 5, - "duration": 150 + "duration": 5 }, { "index": 6, - "duration": 150 + "duration": 5 }, { "index": 7, - "duration": 150 + "duration": 5 }, { "index": 8, - "duration": 150 + "duration": 5 }, { "index": 9, - "duration": 150 + "duration": 5 }, { "index": 10, - "duration": 150 + "duration": 5 }, { "index": 11, - "duration": 150 + "duration": 5 } ] }, @@ -65,11 +65,11 @@ "frames": [ { "index": 44, - "duration": 100 + "duration": 10 }, { "index": 45, - "duration": 100 + "duration": 10 } ] @@ -80,23 +80,23 @@ "frames": [ { "index": 30, - "duration": 150 + "duration": 10 }, { "index": 31, - "duration": 100 + "duration": 5 }, { "index": 32, - "duration": 150 + "duration": 10 }, { "index": 31, - "duration": 100 + "duration": 5 }, { "index": 30, - "duration": 150 + "duration": 10 } ] }, @@ -106,23 +106,23 @@ "frames": [ { "index": 20, - "duration": 150 + "duration": 10 }, { "index": 21, - "duration": 150 + "duration": 10 }, { "index": 22, - "duration": 150 + "duration": 10 }, { "index": 23, - "duration": 150 + "duration": 10 }, { "index": 24, - "duration": 150 + "duration": 10 } ] }, @@ -132,23 +132,23 @@ "frames": [ { "index": 25, - "duration": 150 + "duration": 10 }, { "index": 26, - "duration": 150 + "duration": 10 }, { "index": 27, - "duration": 150 + "duration": 10 }, { "index": 28, - "duration": 150 + "duration": 10 }, { "index": 29, - "duration": 150 + "duration": 10 } ] }, @@ -158,15 +158,15 @@ "frames": [ { "index": 33, - "duration": 250 + "duration": 10 }, { "index": 34, - "duration": 400 + "duration": 5 }, { "index": 35, - "duration": 250 + "duration": 10 } ] }, @@ -176,15 +176,15 @@ "frames": [ { "index": 33, - "duration": 150 + "duration": 10 }, { "index": 34, - "duration": 100 + "duration": 5 }, { "index": 35, - "duration": 150 + "duration": 10 } ] }, @@ -194,15 +194,15 @@ "frames": [ { "index": 36, - "duration": 150 + "duration": 10 }, { "index": 37, - "duration": 100 + "duration": 5 }, { "index": 38, - "duration": 150 + "duration": 10 } ] }, @@ -278,19 +278,19 @@ "frames": [ { "index": 0, - "duration": 150 + "duration": 10 }, { "index": 40, - "duration": 100 + "duration": 5 }, { "index": 41, - "duration": 100 + "duration": 5 }, { "index": 42, - "duration": 150 + "duration": 10 } ] }, @@ -300,7 +300,7 @@ "frames": [ { "index": 43, - "duration": 150 + "duration": 10 } ] } diff --git a/src/shattered_sword/AI/EnemyAI.ts b/src/shattered_sword/AI/EnemyAI.ts index 6401d78..1a127c9 100644 --- a/src/shattered_sword/AI/EnemyAI.ts +++ b/src/shattered_sword/AI/EnemyAI.ts @@ -83,6 +83,8 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { burnStat: Sprite; bleedStat: Sprite; + attackTimer : Timer; + initializeAI(owner: AnimatedSprite, options: Record): void { this.owner = owner; @@ -126,7 +128,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { this.bleedTimer = new Timer(1000); this.poisonTimer = new Timer(1000); - + this.attackTimer = new Timer(500); } activate(options: Record): void { } @@ -269,8 +271,9 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI { if( distance <= 60){ if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){ let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize(); - if(this.weapon.use(this.owner, "enemy", dir.scale(1,0))){ - + if(this.attackTimer.isPaused()){ + this.weapon.use(this.owner, "enemy", dir.scale(1,0)) + this.attackTimer.start(); } } diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 7a8e64d..29466ce 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -20,7 +20,7 @@ import InputWrapper from "../Tools/InputWrapper"; import EnemyAI from "../AI/EnemyAI"; import Timer from "../../Wolfie2D/Timing/Timer"; import PlayerState from "./PlayerStates/PlayerState"; - +import { GameEventType } from "../../Wolfie2D/Events/GameEventType"; export enum PlayerType { PLATFORMER = "platformer", @@ -266,6 +266,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA (this.owner).animation.play("HURT" ); damage /= this.BASE_DEF/ this.CURRENT_DEF; this.CURRENT_HP -= damage; + this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "hurt", loop: false, holdReference: false}); + //if player has shield buff give them shield when damaged if(this.hasShield){ this.CURRENT_SHIELD += damage * .5; diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 58ce366..1696741 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -141,6 +141,11 @@ export default class GameLevel extends Scene { // Load in item info //this.load.object("itemData", "shattered_sword_assets/data/items.json"); + this.load.audio("jump", "shattered_sword_assets/sounds/jump2.wav"); + this.load.audio("hurt", "shattered_sword_assets/sounds/hurt.wav"); + this.load.audio("die", "shattered_sword_assets/sounds/die.wav"); + + this.load.image("knife", "shattered_sword_assets/sprites/knife.png"); this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");