added jump and hurt sound

This commit is contained in:
OfficialCHenry 2022-04-21 14:34:14 -04:00
parent 2cd51cdbbd
commit 67c9a89f82
7 changed files with 14 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -83,6 +83,8 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
burnStat: Sprite;
bleedStat: Sprite;
attackTimer : Timer;
initializeAI(owner: AnimatedSprite, options: Record<string, any>): 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<string, any>): 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();
}
}

View File

@ -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
(<AnimatedSprite>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;

View File

@ -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");