added new Hiro animations

This commit is contained in:
OfficialCHenry 2022-04-11 16:28:58 -04:00
parent 66c698dd43
commit c60d5b9c9a
11 changed files with 357 additions and 37 deletions

View File

@ -1,27 +1,251 @@
{
"name": "Hiro",
"name" : "Hiro",
"spriteSheetImage": "Hiro.png",
"spriteWidth": 32,
"spriteHeight": 32,
"columns": 1,
"rows": 1,
"spriteWidth": 64,
"spriteHeight": 64,
"columns": 7,
"rows": 7,
"durationType": "time",
"animations": [
{
"name": "IDLE",
"frames": [ {"index": 0, "duration": 540} ]
"repeat": true,
"frames": [
{
"index": 0,
"duration": 150
},
{
"name": "JUMP",
"frames":[ {"index": 0, "duration": 32}]
"index": 1,
"duration": 150
}
]
},
{
"name": "WALK",
"frames": [ {"index": 0, "duration": 540} ]
"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",
"frames": [ {"index": 0, "duration": 540} ]
"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
}
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

After

Width:  |  Height:  |  Size: 18 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -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);
}
}

View File

@ -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 = (<Sprite>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");

View File

@ -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();
(<AnimatedSprite>this.owner).animation.playIfNotAlready("ATTACK", true);
//TODO - get proper look direction
this.lookDirection.x = (<Sprite>this.owner).invertX ? -1 : 1;
// If there is an item in the current slot, use it

View File

@ -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();

View File

@ -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",