added new Hiro animations
This commit is contained in:
parent
66c698dd43
commit
c60d5b9c9a
274
dist/shattered_sword_assets/spritesheets/Hiro.json
vendored
274
dist/shattered_sword_assets/spritesheets/Hiro.json
vendored
|
@ -1,27 +1,251 @@
|
||||||
{
|
{
|
||||||
"name": "Hiro",
|
"name" : "Hiro",
|
||||||
"spriteSheetImage": "Hiro.png",
|
"spriteSheetImage": "Hiro.png",
|
||||||
"spriteWidth": 32,
|
"spriteWidth": 64,
|
||||||
"spriteHeight": 32,
|
"spriteHeight": 64,
|
||||||
"columns": 1,
|
"columns": 7,
|
||||||
"rows": 1,
|
"rows": 7,
|
||||||
"durationType": "time",
|
"durationType": "time",
|
||||||
"animations": [
|
"animations": [
|
||||||
{
|
|
||||||
"name": "IDLE",
|
{
|
||||||
"frames": [ {"index": 0, "duration": 540} ]
|
"name": "IDLE",
|
||||||
},
|
"repeat": true,
|
||||||
{
|
"frames": [
|
||||||
"name": "JUMP",
|
{
|
||||||
"frames":[ {"index": 0, "duration": 32}]
|
"index": 0,
|
||||||
},
|
"duration": 150
|
||||||
{
|
},
|
||||||
"name": "WALK",
|
{
|
||||||
"frames": [ {"index": 0, "duration": 540} ]
|
"index": 1,
|
||||||
},
|
"duration": 150
|
||||||
{
|
}
|
||||||
"name": "FALL",
|
|
||||||
"frames": [ {"index": 0, "duration": 540} ]
|
]
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
BIN
dist/shattered_sword_assets/spritesheets/Hiro.png
vendored
BIN
dist/shattered_sword_assets/spritesheets/Hiro.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 819 B After Width: | Height: | Size: 18 KiB |
27
dist/shattered_sword_assets/spritesheets/Hiro1.json
vendored
Normal file
27
dist/shattered_sword_assets/spritesheets/Hiro1.json
vendored
Normal file
|
@ -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} ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
dist/shattered_sword_assets/spritesheets/Hiro1.png
vendored
Normal file
BIN
dist/shattered_sword_assets/spritesheets/Hiro1.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 819 B |
66
dist/shattered_sword_assets/spritesheets/Tiger.json
vendored
Normal file
66
dist/shattered_sword_assets/spritesheets/Tiger.json
vendored
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
BIN
dist/shattered_sword_assets/spritesheets/Tiger.png
vendored
Normal file
BIN
dist/shattered_sword_assets/spritesheets/Tiger.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
|
@ -50,6 +50,7 @@ export default class PlayerController extends ControllerAI {
|
||||||
if(velocity.x === 0){
|
if(velocity.x === 0){
|
||||||
this.owner.animation.playIfNotAlready("IDLE", true);
|
this.owner.animation.playIfNotAlready("IDLE", true);
|
||||||
} else {
|
} else {
|
||||||
|
console.log("walking anim");
|
||||||
this.owner.animation.playIfNotAlready("WALK", true);
|
this.owner.animation.playIfNotAlready("WALK", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ export default class Slice extends WeaponType {
|
||||||
doAnimation(attacker: GameNode, direction: Vec2, extraRange:number,sliceSprite: AnimatedSprite): void {
|
doAnimation(attacker: GameNode, direction: Vec2, extraRange:number,sliceSprite: AnimatedSprite): void {
|
||||||
//TODO-
|
//TODO-
|
||||||
//4 to scale up the default sprite - may be different later depending on atk anim
|
//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.scaleX = 2*(1+extraRange); //might have to add extra range to y as well
|
||||||
sliceSprite.scaleY = 4;
|
sliceSprite.scaleY = 2;
|
||||||
|
|
||||||
// Rotate this with the game node
|
// Rotate this with the game node
|
||||||
// TODO - need to rotate the anim properly
|
// TODO - need to rotate the anim properly
|
||||||
|
@ -27,8 +27,8 @@ export default class Slice extends WeaponType {
|
||||||
sliceSprite.rotation = (<Sprite>attacker).invertX? .5* Math.PI : 1.5 * Math.PI;
|
sliceSprite.rotation = (<Sprite>attacker).invertX? .5* Math.PI : 1.5 * Math.PI;
|
||||||
// Move the slice out from the player
|
// Move the slice out from the player
|
||||||
//scale = num of pixels between center of sprite and atk anim
|
//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
|
// Play the slice animation w/o loop, but queue the normal animation
|
||||||
sliceSprite.animation.play("SLICE");
|
sliceSprite.animation.play("SLICE");
|
||||||
|
|
|
@ -16,6 +16,7 @@ import Input from "../../Wolfie2D/Input/Input";
|
||||||
import BattlerAI from "../AI/BattlerAI";
|
import BattlerAI from "../AI/BattlerAI";
|
||||||
import MathUtils from "../../Wolfie2D/Utils/MathUtils";
|
import MathUtils from "../../Wolfie2D/Utils/MathUtils";
|
||||||
import Weapon from "../GameSystems/items/Weapon";
|
import Weapon from "../GameSystems/items/Weapon";
|
||||||
|
import AnimatedSprite from "../../Wolfie2D/Nodes/Sprites/AnimatedSprite";
|
||||||
|
|
||||||
|
|
||||||
export enum PlayerType {
|
export enum PlayerType {
|
||||||
|
@ -86,8 +87,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
CURRENT_BUFFS: {
|
CURRENT_BUFFS: {
|
||||||
atk: number; //flat value to add to weapon
|
atk: number; //flat value to add to weapon
|
||||||
hp: number; //flat value
|
hp: number; //flat value
|
||||||
def: number; //falt value
|
def: number; //flat value
|
||||||
speed: number;
|
speed: number; //flat value
|
||||||
range:number; //range will be a multiplier value: 1.5 = 150% range
|
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};
|
this.CURRENT_BUFFS = {hp:0, atk:0, def:0, speed:0, range:0};
|
||||||
|
|
||||||
//to test the buffs
|
//to test the buffs
|
||||||
this.addBuff( {type:BuffType.HEALTH, value:1, bonus:false} );
|
//this.addBuff( {type:BuffType.HEALTH, value:1, bonus:false} );
|
||||||
this.addBuff( {type:BuffType.RANGE, value:1, bonus:false} );
|
//this.addBuff( {type:BuffType.RANGE, value:1, bonus:false} );
|
||||||
}
|
}
|
||||||
|
|
||||||
initializePlatformer(): void {
|
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
|
//testing the attacks here, may be moved to another place latera
|
||||||
if(Input.isJustPressed("attack")){
|
if(Input.isJustPressed("attack")){
|
||||||
let item = this.inventory.getItem();
|
let item = this.inventory.getItem();
|
||||||
|
(<AnimatedSprite>this.owner).animation.playIfNotAlready("ATTACK", true);
|
||||||
//TODO - get proper look direction
|
//TODO - get proper look direction
|
||||||
this.lookDirection.x = (<Sprite>this.owner).invertX ? -1 : 1;
|
this.lookDirection.x = (<Sprite>this.owner).invertX ? -1 : 1;
|
||||||
// If there is an item in the current slot, use it
|
// If there is an item in the current slot, use it
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default class Walk extends OnGround {
|
||||||
|
|
||||||
update(deltaT: number): void {
|
update(deltaT: number): void {
|
||||||
super.update(deltaT);
|
super.update(deltaT);
|
||||||
|
//console.log("walking anim");
|
||||||
this.owner.animation.playIfNotAlready("WALK", true);
|
this.owner.animation.playIfNotAlready("WALK", true);
|
||||||
|
|
||||||
let dir = this.getInputDirection();
|
let dir = this.getInputDirection();
|
||||||
|
|
|
@ -366,14 +366,14 @@ export default class GameLevel extends Scene {
|
||||||
|
|
||||||
// Add the player
|
// Add the player
|
||||||
this.player = this.add.animatedSprite("player", "primary");
|
this.player = this.add.animatedSprite("player", "primary");
|
||||||
this.player.scale.set(2, 2);
|
this.player.scale.set(1, 1);
|
||||||
if(!this.playerSpawn){
|
if(!this.playerSpawn){
|
||||||
console.warn("Player spawn was never set - setting spawn to (0, 0)");
|
console.warn("Player spawn was never set - setting spawn to (0, 0)");
|
||||||
this.playerSpawn = Vec2.ZERO;
|
this.playerSpawn = Vec2.ZERO;
|
||||||
}
|
}
|
||||||
this.player.position.copy(this.playerSpawn);
|
this.player.position.copy(this.playerSpawn);
|
||||||
this.player.addPhysics(new AABB(Vec2.ZERO, new Vec2(32, 32))); //sets the collision shape
|
this.player.addPhysics(new AABB(Vec2.ZERO, new Vec2(14, 16))); //sets the collision shape
|
||||||
this.player.colliderOffset.set(0, 0);
|
this.player.colliderOffset.set(0, 16);
|
||||||
this.player.addAI(PlayerController, {
|
this.player.addAI(PlayerController, {
|
||||||
playerType: "platformer",
|
playerType: "platformer",
|
||||||
tilemap: "Main",
|
tilemap: "Main",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user