diff --git a/dist/shattered_sword_assets/spritesheets/Hiro.json b/dist/shattered_sword_assets/spritesheets/Hiro.json index d5b285f..bc3ec3f 100644 --- a/dist/shattered_sword_assets/spritesheets/Hiro.json +++ b/dist/shattered_sword_assets/spritesheets/Hiro.json @@ -212,11 +212,11 @@ "frames": [ { "index": 0, - "duration": 50 + "duration": 500 }, { "index": 39, - "duration": 50 + "duration": 500 } ] }, diff --git a/dist/shattered_sword_assets/spritesheets/Hiro1.json b/dist/shattered_sword_assets/spritesheets/Hiro1.json deleted file mode 100644 index f593278..0000000 --- a/dist/shattered_sword_assets/spritesheets/Hiro1.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Hiro", - "spriteSheetImage": "Hiro.png", - "spriteWidth": 32, - "spriteHeight": 32, - "columns": 1, - "rows": 1, - "durationType": "time", - "animations": [ - { - "name": "IDLE", - "frames": [ {"index": 0, "duration": 540} ] - }, - { - "name": "JUMP", - "frames":[ {"index": 0, "duration": 32}] - }, - { - "name": "WALK", - "frames": [ {"index": 0, "duration": 540} ] - }, - { - "name": "FALL", - "frames": [ {"index": 0, "duration": 540} ] - } - ] -} \ No newline at end of file diff --git a/dist/shattered_sword_assets/spritesheets/Hiro1.png b/dist/shattered_sword_assets/spritesheets/Hiro1.png deleted file mode 100644 index 729338f..0000000 Binary files a/dist/shattered_sword_assets/spritesheets/Hiro1.png and /dev/null differ diff --git a/src/shattered_sword/AI/EnemyStates/Patrol.ts b/src/shattered_sword/AI/EnemyStates/Patrol.ts index d605e28..dd395d6 100644 --- a/src/shattered_sword/AI/EnemyStates/Patrol.ts +++ b/src/shattered_sword/AI/EnemyStates/Patrol.ts @@ -23,7 +23,12 @@ export default class Patrol extends EnemyState { onEnter(options: Record): void { //this.currentPath = this.getNextPath(); - (this.owner).animation.play("IDLE", true); + //if(!(this.owner).animation.isPlaying("DYING")){ + //(this.owner).animation.queue("IDLE", true); + //} + //else{ + (this.owner).animation.playIfNotAlready("IDLE", true); + //} } handleInput(event: GameEvent): void { } diff --git a/src/shattered_sword/GameSystems/BattleManager.ts b/src/shattered_sword/GameSystems/BattleManager.ts index ba62595..fa55b93 100644 --- a/src/shattered_sword/GameSystems/BattleManager.ts +++ b/src/shattered_sword/GameSystems/BattleManager.ts @@ -20,6 +20,10 @@ export default class BattleManager { if (weapon.hits(enemy.owner)) { enemy.damage(weapon.type.damage + weapon.EXTRA_DAMAGE); //console.log("enemy took dmg"); + + //TODO - test shield, + //add checking for each onhit buff here + (this.players[0]).addShield(1); } } } @@ -28,6 +32,7 @@ export default class BattleManager { for (let player of this.players) { if (weapon.hits(player.owner)) { (player).damage(weapon.type.damage, user); + } } } diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 313430f..65c433c 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -72,10 +72,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA CURRENT_DEF: number = 100; CURRENT_EXP : number = 0; MAX_EXP : number = 100; - //shield buff CURRENT_SHIELD : number =0; MAX_SHIELD : number = 20; - invincible : boolean = false; tilemap: OrthogonalTilemap; @@ -85,7 +83,6 @@ export default class PlayerController extends StateMachineAI implements BattlerA airjumps:number = 0; private lookDirection: Vec2; - /** A list of items in the game world */ private items: Array; @@ -110,20 +107,21 @@ export default class PlayerController extends StateMachineAI implements BattlerA //shield absorbs the damage and sends dmg back to attacker if(this.CURRENT_SHIELD > 0){ let newshield = Math.max(0, this.CURRENT_SHIELD - damage ); //calculate the new shield value - (attacker._ai).damage(this.CURRENT_SHIELD - newshield); //damage the attacker the dmg taken to shield + if( attacker !== undefined){ + (attacker._ai).damage(this.CURRENT_SHIELD - newshield); //damage the attacker the dmg taken to shield + } this.CURRENT_SHIELD = newshield; //update shield value } else{ //i frame here PlayerController.invincibilityTimer.start(); this.invincible = true; - - (this.owner).animation.playIfNotAlready("HURT", false); + //console.log("hurt anim"); + (this.owner).animation.play("HURT" ); this.CURRENT_HP -= damage; if(this.CURRENT_HP <= 0){ - this.emitter.fireEvent(Player_Events.PLAYER_KILLED); - (this.owner).animation.playIfNotAlready("DYING", false); - (this.owner).animation.queue("DEAD", false); + (this.owner).animation.play("DYING"); + (this.owner).animation.queue("DEAD", true, Player_Events.PLAYER_KILLED); } } @@ -236,7 +234,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA //this.addBuff( {type:BuffType.HEALTH, value:1} ); //i frame timer - PlayerController.invincibilityTimer = new Timer(400); + PlayerController.invincibilityTimer = new Timer(2000); } initializePlatformer(): void { @@ -285,7 +283,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA //testing the attacks here, may be moved to another place later if(InputWrapper.isAttackJustPressed()){ let item = this.inventory.getItem(); - (this.owner).animation.playIfNotAlready("ATTACK", true); + (this.owner).animation.play("ATTACK", true); //TODO - get proper look direction this.lookDirection.x = (this.owner).invertX ? -1 : 1; // If there is an item in the current slot, use it diff --git a/src/shattered_sword/Player/PlayerStates/Walk.ts b/src/shattered_sword/Player/PlayerStates/Walk.ts index e00b116..af79454 100644 --- a/src/shattered_sword/Player/PlayerStates/Walk.ts +++ b/src/shattered_sword/Player/PlayerStates/Walk.ts @@ -13,7 +13,7 @@ export default class Walk extends OnGround { update(deltaT: number): void { - //console.log("walking anim"); + console.log("walking anim"); this.owner.animation.playIfNotAlready("WALK", true); let dir = this.getInputDirection(); diff --git a/src/shattered_sword/Scenes/GameLevel.ts b/src/shattered_sword/Scenes/GameLevel.ts index 92048f3..3b8374b 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -718,7 +718,6 @@ export default class GameLevel extends Scene { } if(typeof enemy != undefined && typeof player != undefined){ //damage the player - console.log("player collision damage"); (this.player._ai).damage(10); //10 collision dmg for now }