Merge remote-tracking branch 'github/master'

This commit is contained in:
Renge 2022-04-21 14:50:47 -04:00
commit d1b32642d5
8 changed files with 55 additions and 45 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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
}
]
}

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