diff --git a/dist/shattered_sword_assets/spritesheets/Hiro.json b/dist/shattered_sword_assets/spritesheets/Hiro.json index f593278..86c3768 100644 --- a/dist/shattered_sword_assets/spritesheets/Hiro.json +++ b/dist/shattered_sword_assets/spritesheets/Hiro.json @@ -1,27 +1,251 @@ { - "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} ] - } - ] + "name" : "Hiro", + "spriteSheetImage": "Hiro.png", + "spriteWidth": 64, + "spriteHeight": 64, + "columns": 7, + "rows": 7, + "durationType": "time", + "animations": [ + + { + "name": "IDLE", + "repeat": true, + "frames": [ + { + "index": 0, + "duration": 150 + }, + { + "index": 1, + "duration": 150 + } + + ] + }, + { + "name": "WALK", + "repeat": true, + "frames": [ + { + "index": 4, + "duration": 150 + }, + { + "index": 5, + "duration": 150 + }, + { + "index": 6, + "duration": 150 + }, + { + "index": 7, + "duration": 150 + }, + { + "index": 8, + "duration": 150 + }, + { + "index": 9, + "duration": 150 + }, + { + "index": 10, + "duration": 150 + }, + { + "index": 11, + "duration": 150 + } + ] + }, + { + "name": "JUMP", + "repeat": false, + "frames": [ + { + "index": 20, + "duration": 150 + }, + { + "index": 21, + "duration": 150 + }, + { + "index": 22, + "duration": 150 + }, + { + "index": 23, + "duration": 150 + }, + { + "index": 24, + "duration": 150 + } + ] + }, + { + "name": "FALL", + "repeat": true, + "frames": [ + { + "index": 0, + "duration": 150 + }, + { + "index": 1, + "duration": 150 + } + + ] + }, + + { + "name": "JUMP_LEFT", + "repeat": false, + "frames": [ + { + "index": 25, + "duration": 150 + }, + { + "index": 26, + "duration": 150 + }, + { + "index": 27, + "duration": 150 + }, + { + "index": 28, + "duration": 150 + }, + { + "index": 29, + "duration": 150 + } + ] + }, + { + "name": "JUMP_UP", + "repeat": false, + "frames": [ + { + "index": 30, + "duration": 150 + }, + { + "index": 31, + "duration": 150 + }, + { + "index": 32, + "duration": 150 + } + ] + }, + { + "name": "ATTACK", + "repeat": false, + "frames": [ + { + "index": 33, + "duration": 250 + }, + { + "index": 34, + "duration": 400 + }, + { + "index": 35, + "duration": 250 + } + ] + }, + { + "name": "ATTACK_RIGHT", + "repeat": false, + "frames": [ + { + "index": 33, + "duration": 150 + }, + { + "index": 34, + "duration": 100 + }, + { + "index": 35, + "duration": 150 + } + ] + }, + { + "name": "ATTACK_LEFT", + "repeat": false, + "frames": [ + { + "index": 36, + "duration": 150 + }, + { + "index": 37, + "duration": 100 + }, + { + "index": 38, + "duration": 150 + } + ] + }, + { + "name": "HURT", + "repeat": true, + "frames": [ + { + "index": 0, + "duration": 50 + }, + { + "index": 39, + "duration": 50 + } + ] + }, + { + "name": "DYING", + "repeat": false, + "frames": [ + { + "index": 0, + "duration": 150 + }, + { + "index": 40, + "duration": 100 + }, + { + "index": 41, + "duration": 100 + }, + { + "index": 42, + "duration": 150 + } + ] + }, + { + "name": "DEAD", + "repeat": true, + "frames": [ + { + "index": 43, + "duration": 150 + } + ] + } + ] } \ No newline at end of file diff --git a/dist/shattered_sword_assets/spritesheets/Hiro.png b/dist/shattered_sword_assets/spritesheets/Hiro.png index 729338f..7b20265 100644 Binary files a/dist/shattered_sword_assets/spritesheets/Hiro.png and b/dist/shattered_sword_assets/spritesheets/Hiro.png differ diff --git a/dist/shattered_sword_assets/spritesheets/Hiro1.json b/dist/shattered_sword_assets/spritesheets/Hiro1.json new file mode 100644 index 0000000..f593278 --- /dev/null +++ b/dist/shattered_sword_assets/spritesheets/Hiro1.json @@ -0,0 +1,27 @@ +{ + "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 new file mode 100644 index 0000000..729338f Binary files /dev/null and b/dist/shattered_sword_assets/spritesheets/Hiro1.png differ diff --git a/dist/shattered_sword_assets/spritesheets/Tiger.json b/dist/shattered_sword_assets/spritesheets/Tiger.json new file mode 100644 index 0000000..dc6d3fc --- /dev/null +++ b/dist/shattered_sword_assets/spritesheets/Tiger.json @@ -0,0 +1,66 @@ +{ + "name" : "Tiger", + "spriteSheetImage": "Tiger.png", + "spriteWidth": 192, + "spriteHeight": 192, + "columns": 3, + "rows": 3, + "durationType": "time", + "animations": [ + { + "name": "IDLE", + "repeat": true, + "frames": [ + { + "index": 0, + "duration": 150 + } + + ] + }, + { + "name": "WALK_RIGHT", + "repeat": true, + "frames": [ + { + "index": 1, + "duration": 150 + }, + { + "index": 2, + "duration": 150 + }, + { + "index": 3, + "duration": 150 + }, + { + "index": 4, + "duration": 150 + } + ] + }, + { + "name": "WALK_LEFT", + "repeat": true, + "frames": [ + { + "index": 5, + "duration": 150 + }, + { + "index": 6, + "duration": 150 + }, + { + "index": 7, + "duration": 150 + }, + { + "index": 8, + "duration": 150 + } + ] + } + ] +} diff --git a/dist/shattered_sword_assets/spritesheets/Tiger.png b/dist/shattered_sword_assets/spritesheets/Tiger.png new file mode 100644 index 0000000..4567024 Binary files /dev/null and b/dist/shattered_sword_assets/spritesheets/Tiger.png differ diff --git a/src/demos/PlatformerPlayerController.ts b/src/demos/PlatformerPlayerController.ts index 60d7be7..13358a7 100644 --- a/src/demos/PlatformerPlayerController.ts +++ b/src/demos/PlatformerPlayerController.ts @@ -50,6 +50,7 @@ export default class PlayerController extends ControllerAI { if(velocity.x === 0){ this.owner.animation.playIfNotAlready("IDLE", true); } else { + console.log("walking anim"); this.owner.animation.playIfNotAlready("WALK", true); } } diff --git a/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts b/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts index 49f2040..9e38bc3 100644 --- a/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts +++ b/src/shattered_sword/GameSystems/items/WeaponTypes/Slice.ts @@ -18,8 +18,8 @@ export default class Slice extends WeaponType { doAnimation(attacker: GameNode, direction: Vec2, extraRange:number,sliceSprite: AnimatedSprite): void { //TODO- //4 to scale up the default sprite - may be different later depending on atk anim - sliceSprite.scaleX = 4*(1+extraRange); //might have to add extra range to y as well - sliceSprite.scaleY = 4; + sliceSprite.scaleX = 2*(1+extraRange); //might have to add extra range to y as well + sliceSprite.scaleY = 2; // Rotate this with the game node // TODO - need to rotate the anim properly @@ -27,8 +27,8 @@ export default class Slice extends WeaponType { sliceSprite.rotation = (attacker).invertX? .5* Math.PI : 1.5 * Math.PI; // Move the slice out from the player //scale = num of pixels between center of sprite and atk anim - sliceSprite.position = attacker.position.clone().add(direction.scaled(65)); - + sliceSprite.position = attacker.position.clone().add(direction.scaled(32)); + sliceSprite.position = sliceSprite.position.add(new Vec2(0,16)); //make it go down a bit // Play the slice animation w/o loop, but queue the normal animation sliceSprite.animation.play("SLICE"); diff --git a/src/shattered_sword/Player/PlayerController.ts b/src/shattered_sword/Player/PlayerController.ts index 4367b16..3f92b95 100644 --- a/src/shattered_sword/Player/PlayerController.ts +++ b/src/shattered_sword/Player/PlayerController.ts @@ -16,6 +16,7 @@ import Input from "../../Wolfie2D/Input/Input"; import BattlerAI from "../AI/BattlerAI"; import MathUtils from "../../Wolfie2D/Utils/MathUtils"; import Weapon from "../GameSystems/items/Weapon"; +import AnimatedSprite from "../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; export enum PlayerType { @@ -86,8 +87,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA CURRENT_BUFFS: { atk: number; //flat value to add to weapon hp: number; //flat value - def: number; //falt value - speed: number; + def: number; //flat value + speed: number; //flat value range:number; //range will be a multiplier value: 1.5 = 150% range } @@ -154,8 +155,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA this.CURRENT_BUFFS = {hp:0, atk:0, def:0, speed:0, range:0}; //to test the buffs - this.addBuff( {type:BuffType.HEALTH, value:1, bonus:false} ); - this.addBuff( {type:BuffType.RANGE, value:1, bonus:false} ); + //this.addBuff( {type:BuffType.HEALTH, value:1, bonus:false} ); + //this.addBuff( {type:BuffType.RANGE, value:1, bonus:false} ); } initializePlatformer(): void { @@ -201,6 +202,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA //testing the attacks here, may be moved to another place latera if(Input.isJustPressed("attack")){ let item = this.inventory.getItem(); + (this.owner).animation.playIfNotAlready("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 28fbc20..c672b03 100644 --- a/src/shattered_sword/Player/PlayerStates/Walk.ts +++ b/src/shattered_sword/Player/PlayerStates/Walk.ts @@ -14,7 +14,7 @@ export default class Walk extends OnGround { update(deltaT: number): void { super.update(deltaT); - + //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 5f42d26..9e50583 100644 --- a/src/shattered_sword/Scenes/GameLevel.ts +++ b/src/shattered_sword/Scenes/GameLevel.ts @@ -366,14 +366,14 @@ export default class GameLevel extends Scene { // Add the player this.player = this.add.animatedSprite("player", "primary"); - this.player.scale.set(2, 2); + this.player.scale.set(1, 1); if(!this.playerSpawn){ console.warn("Player spawn was never set - setting spawn to (0, 0)"); this.playerSpawn = Vec2.ZERO; } this.player.position.copy(this.playerSpawn); - this.player.addPhysics(new AABB(Vec2.ZERO, new Vec2(32, 32))); //sets the collision shape - this.player.colliderOffset.set(0, 0); + this.player.addPhysics(new AABB(Vec2.ZERO, new Vec2(14, 16))); //sets the collision shape + this.player.colliderOffset.set(0, 16); this.player.addAI(PlayerController, { playerType: "platformer", tilemap: "Main",