added jump and hurt sound
This commit is contained in:
parent
2cd51cdbbd
commit
67c9a89f82
BIN
dist/shattered_sword_assets/sounds/die.wav
vendored
Normal file
BIN
dist/shattered_sword_assets/sounds/die.wav
vendored
Normal file
Binary file not shown.
BIN
dist/shattered_sword_assets/sounds/hurt.wav
vendored
Normal file
BIN
dist/shattered_sword_assets/sounds/hurt.wav
vendored
Normal file
Binary file not shown.
BIN
dist/shattered_sword_assets/sounds/jump.wav
vendored
Normal file
BIN
dist/shattered_sword_assets/sounds/jump.wav
vendored
Normal file
Binary file not shown.
BIN
dist/shattered_sword_assets/sounds/jump2.wav
vendored
Normal file
BIN
dist/shattered_sword_assets/sounds/jump2.wav
vendored
Normal file
Binary file not shown.
|
@ -83,6 +83,8 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||||
burnStat: Sprite;
|
burnStat: Sprite;
|
||||||
bleedStat: Sprite;
|
bleedStat: Sprite;
|
||||||
|
|
||||||
|
attackTimer : Timer;
|
||||||
|
|
||||||
|
|
||||||
initializeAI(owner: AnimatedSprite, options: Record<string, any>): void {
|
initializeAI(owner: AnimatedSprite, options: Record<string, any>): void {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
@ -126,7 +128,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||||
this.bleedTimer = new Timer(1000);
|
this.bleedTimer = new Timer(1000);
|
||||||
this.poisonTimer = new Timer(1000);
|
this.poisonTimer = new Timer(1000);
|
||||||
|
|
||||||
|
this.attackTimer = new Timer(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
activate(options: Record<string, any>): void { }
|
activate(options: Record<string, any>): void { }
|
||||||
|
@ -269,8 +271,9 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||||
if( distance <= 60){
|
if( distance <= 60){
|
||||||
if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){
|
if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){
|
||||||
let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import InputWrapper from "../Tools/InputWrapper";
|
||||||
import EnemyAI from "../AI/EnemyAI";
|
import EnemyAI from "../AI/EnemyAI";
|
||||||
import Timer from "../../Wolfie2D/Timing/Timer";
|
import Timer from "../../Wolfie2D/Timing/Timer";
|
||||||
import PlayerState from "./PlayerStates/PlayerState";
|
import PlayerState from "./PlayerStates/PlayerState";
|
||||||
|
import { GameEventType } from "../../Wolfie2D/Events/GameEventType";
|
||||||
|
|
||||||
export enum PlayerType {
|
export enum PlayerType {
|
||||||
PLATFORMER = "platformer",
|
PLATFORMER = "platformer",
|
||||||
|
@ -266,6 +266,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
(<AnimatedSprite>this.owner).animation.play("HURT" );
|
(<AnimatedSprite>this.owner).animation.play("HURT" );
|
||||||
damage /= this.BASE_DEF/ this.CURRENT_DEF;
|
damage /= this.BASE_DEF/ this.CURRENT_DEF;
|
||||||
this.CURRENT_HP -= damage;
|
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 player has shield buff give them shield when damaged
|
||||||
if(this.hasShield){
|
if(this.hasShield){
|
||||||
this.CURRENT_SHIELD += damage * .5;
|
this.CURRENT_SHIELD += damage * .5;
|
||||||
|
|
|
@ -141,6 +141,11 @@ export default class GameLevel extends Scene {
|
||||||
// Load in item info
|
// Load in item info
|
||||||
//this.load.object("itemData", "shattered_sword_assets/data/items.json");
|
//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.image("knife", "shattered_sword_assets/sprites/knife.png");
|
||||||
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
|
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user