changed some enemy collision sizes, added slice outlines, fixed enemy attack times, added damage multiplier instead of def
This commit is contained in:
parent
6f66b9666c
commit
a05c0a1721
|
@ -7,7 +7,7 @@
|
||||||
"displayName": "Knife",
|
"displayName": "Knife",
|
||||||
"animationSprite": "slice",
|
"animationSprite": "slice",
|
||||||
"spriteKey": "knife",
|
"spriteKey": "knife",
|
||||||
"damage": 50,
|
"damage": 10,
|
||||||
"cooldown": 30,
|
"cooldown": 30,
|
||||||
"useVolume": 0
|
"useVolume": 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "slice",
|
"name": "slice",
|
||||||
"spriteSheetImage": "slice.png",
|
"spriteSheetImage": "slice_black.png",
|
||||||
"spriteWidth": 16,
|
"spriteWidth": 16,
|
||||||
"spriteHeight": 16,
|
"spriteHeight": 16,
|
||||||
"columns": 4,
|
"columns": 4,
|
||||||
|
|
BIN
dist/shattered_sword_assets/spritesheets/slice_black.png
vendored
Normal file
BIN
dist/shattered_sword_assets/spritesheets/slice_black.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 270 B |
BIN
dist/shattered_sword_assets/spritesheets/slice_red.png
vendored
Normal file
BIN
dist/shattered_sword_assets/spritesheets/slice_red.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 276 B |
|
@ -128,7 +128,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||||
this.bleedTimer = new Timer(1000);
|
this.bleedTimer = new Timer(1000);
|
||||||
this.poisonTimer = new Timer(1000);
|
this.poisonTimer = new Timer(1000);
|
||||||
|
|
||||||
this.attackTimer = new Timer(500);
|
this.attackTimer = new Timer(2500);
|
||||||
}
|
}
|
||||||
|
|
||||||
activate(options: Record<string, any>): void { }
|
activate(options: Record<string, any>): void { }
|
||||||
|
@ -217,7 +217,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||||
|
|
||||||
if (hit !== null && start.distanceSqTo(hit.pos) < start.distanceSqTo(pos)) {
|
if (hit !== null && start.distanceSqTo(hit.pos) < start.distanceSqTo(pos)) {
|
||||||
// We hit a wall, we can't see the player
|
// We hit a wall, we can't see the player
|
||||||
console.log("player not visible")
|
//console.log("player not visible")
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,10 +287,10 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let distance = this.owner.position.distanceTo(this.getPlayerPosition());
|
let distance = this.owner.position.distanceTo(this.getPlayerPosition());
|
||||||
if( distance <= 60){
|
if( distance <= 20){
|
||||||
if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){
|
if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){
|
||||||
let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize();
|
let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize();
|
||||||
if(this.attackTimer.isPaused()){
|
if(this.attackTimer.isStopped()){
|
||||||
this.weapon.use(this.owner, "enemy", dir.scale(1,0))
|
this.weapon.use(this.owner, "enemy", dir.scale(1,0))
|
||||||
this.attackTimer.start();
|
this.attackTimer.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
MAX_HP: number = 100;
|
MAX_HP: number = 100;
|
||||||
CURRENT_HP: number = 100;
|
CURRENT_HP: number = 100;
|
||||||
BASE_ATK: number = 100;
|
BASE_ATK: number = 100;
|
||||||
MAX_ATK: number = 100;
|
|
||||||
CURRENT_ATK: number = 100;
|
CURRENT_ATK: number = 100;
|
||||||
BASE_DEF: number = 100;
|
damage_multiplier: number = 1;
|
||||||
MAX_DEF: number = 100;
|
|
||||||
CURRENT_DEF: number = 100;
|
|
||||||
CURRENT_EXP : number = 0;
|
CURRENT_EXP : number = 0;
|
||||||
MAX_EXP : number = 100;
|
MAX_EXP : number = 100;
|
||||||
CURRENT_SHIELD : number =0;
|
CURRENT_SHIELD : number =0;
|
||||||
|
@ -117,7 +114,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
|
|
||||||
static invincibilityTimer: Timer;
|
static invincibilityTimer: Timer;
|
||||||
|
|
||||||
static buffPool : Array<BuffCategory>;
|
static buffPool : Array<BuffCategory> = new Array();
|
||||||
|
|
||||||
|
static appliedBuffs: Array<Buff> = new Array();
|
||||||
|
|
||||||
//add to current_buffs later
|
//add to current_buffs later
|
||||||
hasBleed : Boolean = false;
|
hasBleed : Boolean = false;
|
||||||
|
@ -239,7 +238,6 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO - figure out attacker
|
// TODO - figure out attacker
|
||||||
damage(damage: number, attacker?: GameNode): void {
|
damage(damage: number, attacker?: GameNode): void {
|
||||||
if (this.godMode) {
|
if (this.godMode) {
|
||||||
|
@ -265,7 +263,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
this.invincible = true;
|
this.invincible = true;
|
||||||
//console.log("hurt anim");
|
//console.log("hurt anim");
|
||||||
(<AnimatedSprite>this.owner).animation.play("HURT" );
|
(<AnimatedSprite>this.owner).animation.play("HURT" );
|
||||||
damage /= this.BASE_DEF/ this.CURRENT_DEF;
|
damage *= this.damage_multiplier;
|
||||||
|
damage = parseFloat(damage.toPrecision(2));
|
||||||
this.CURRENT_HP -= damage;
|
this.CURRENT_HP -= damage;
|
||||||
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "hurt", loop: false, holdReference: false});
|
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "hurt", loop: false, holdReference: false});
|
||||||
|
|
||||||
|
@ -380,7 +379,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
|
|
||||||
|
|
||||||
let healthBuffs : Buff[] = [
|
let healthBuffs : Buff[] = [
|
||||||
{type:BuffType.DEF, value: num, category: BuffCategory.HEALTH}
|
{type:BuffType.DEF, value: num/10, category: BuffCategory.HEALTH, string: "decrease damage by"+num/10+"%"}
|
||||||
];
|
];
|
||||||
if(!this.hasLifesteal){
|
if(!this.hasLifesteal){
|
||||||
healthBuffs.push({type:BuffType.LIFESTEAL, value:1, category: BuffCategory.HEALTH, string:"Gain lifesteal"});
|
healthBuffs.push({type:BuffType.LIFESTEAL, value:1, category: BuffCategory.HEALTH, string:"Gain lifesteal"});
|
||||||
|
@ -438,7 +437,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
|
|
||||||
//increase weight of selected buff category
|
//increase weight of selected buff category
|
||||||
PlayerController.buffPool.push(buff.category);
|
PlayerController.buffPool.push(buff.category);
|
||||||
|
//add buff to array of applied buffs
|
||||||
|
PlayerController.appliedBuffs.push(buff);
|
||||||
// TODO
|
// TODO
|
||||||
let item = this.inventory.getItem();
|
let item = this.inventory.getItem();
|
||||||
switch(buff.type){
|
switch(buff.type){
|
||||||
|
@ -456,8 +456,7 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
this.speed += buff.value;
|
this.speed += buff.value;
|
||||||
break;
|
break;
|
||||||
case BuffType.DEF:
|
case BuffType.DEF:
|
||||||
this.CURRENT_BUFFS.def += buff.value;
|
this.damage_multiplier *= (1-buff.value);
|
||||||
this.CURRENT_DEF += buff.value;
|
|
||||||
break;
|
break;
|
||||||
case BuffType.RANGE:
|
case BuffType.RANGE:
|
||||||
this.CURRENT_BUFFS.range += buff.value;
|
this.CURRENT_BUFFS.range += buff.value;
|
||||||
|
@ -511,8 +510,20 @@ export default class PlayerController extends StateMachineAI implements BattlerA
|
||||||
this.CURRENT_HP = 1;
|
this.CURRENT_HP = 1;
|
||||||
this.CURRENT_ATK *= 100;
|
this.CURRENT_ATK *= 100;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns record of the player stats
|
||||||
|
*/
|
||||||
|
getStats(): Record<string, any>{
|
||||||
|
let stats = {} as Record<string,any>;
|
||||||
|
stats.current_health = this.CURRENT_HP;
|
||||||
|
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -152,13 +152,14 @@ export default class GameLevel extends Scene {
|
||||||
|
|
||||||
|
|
||||||
this.load.image("knife", "shattered_sword_assets/sprites/knife.png");
|
this.load.image("knife", "shattered_sword_assets/sprites/knife.png");
|
||||||
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
|
|
||||||
this.load.image("inventorySlot", "shattered_sword_assets/sprites/inventory.png");
|
this.load.image("inventorySlot", "shattered_sword_assets/sprites/inventory.png");
|
||||||
this.load.image("black", "shattered_sword_assets/images/black.png");
|
this.load.image("black", "shattered_sword_assets/images/black.png");
|
||||||
this.load.image("poisoning", "shattered_sword_assets/images/poisoning.png");
|
this.load.image("poisoning", "shattered_sword_assets/images/poisoning.png");
|
||||||
this.load.image("burning", "shattered_sword_assets/images/burning.png");
|
this.load.image("burning", "shattered_sword_assets/images/burning.png");
|
||||||
this.load.image("bleeding", "shattered_sword_assets/images/bleeding.png");
|
this.load.image("bleeding", "shattered_sword_assets/images/bleeding.png");
|
||||||
|
|
||||||
|
//TODO - choose spritesheet for slice - modify the slice.json
|
||||||
|
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
|
||||||
this.load.spritesheet("test_dummy","shattered_sword_assets/spritesheets/test_dummy.json")
|
this.load.spritesheet("test_dummy","shattered_sword_assets/spritesheets/test_dummy.json")
|
||||||
this.enemies = new Array();
|
this.enemies = new Array();
|
||||||
this.battleManager = new BattleManager();
|
this.battleManager = new BattleManager();
|
||||||
|
@ -418,6 +419,7 @@ export default class GameLevel extends Scene {
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - this is for testing
|
//TODO - this is for testing
|
||||||
|
/*
|
||||||
if(InputWrapper.isSpawnJustPressed()){
|
if(InputWrapper.isSpawnJustPressed()){
|
||||||
console.log("trying to spawn enemy");
|
console.log("trying to spawn enemy");
|
||||||
this.addEnemy("test_dummy",this.player.position,{player: this.player,
|
this.addEnemy("test_dummy",this.player.position,{player: this.player,
|
||||||
|
@ -431,6 +433,7 @@ export default class GameLevel extends Scene {
|
||||||
weapon : this.createWeapon("knife")
|
weapon : this.createWeapon("knife")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (InputWrapper.isInventoryJustPressed()) {
|
if (InputWrapper.isInventoryJustPressed()) {
|
||||||
console.log("LoadingStory");
|
console.log("LoadingStory");
|
||||||
|
@ -878,8 +881,8 @@ export default class GameLevel extends Scene {
|
||||||
actions: actionsDefault,
|
actions: actionsDefault,
|
||||||
status: statusArray,
|
status: statusArray,
|
||||||
goal: Statuses.REACHED_GOAL,
|
goal: Statuses.REACHED_GOAL,
|
||||||
size: new Vec2(16,16),
|
size: new Vec2(14,10),
|
||||||
offset : new Vec2(0, 16),
|
offset : new Vec2(0, 22),
|
||||||
exp: 50,
|
exp: 50,
|
||||||
weapon : this.createWeapon("knife"),
|
weapon : this.createWeapon("knife"),
|
||||||
})
|
})
|
||||||
|
@ -918,8 +921,8 @@ export default class GameLevel extends Scene {
|
||||||
//actions:actions,
|
//actions:actions,
|
||||||
goal: Statuses.REACHED_GOAL,
|
goal: Statuses.REACHED_GOAL,
|
||||||
scale: .25,
|
scale: .25,
|
||||||
size: new Vec2(16,16),
|
size: new Vec2(16,10),
|
||||||
offset : new Vec2(0,0),
|
offset : new Vec2(0,6),
|
||||||
exp: 50,
|
exp: 50,
|
||||||
weapon : this.createWeapon("knife"),
|
weapon : this.createWeapon("knife"),
|
||||||
actions: actionsDefault,
|
actions: actionsDefault,
|
||||||
|
|
|
@ -37,15 +37,15 @@ export default class Tutorial extends GameLevel {
|
||||||
super.updateScene(deltaT);
|
super.updateScene(deltaT);
|
||||||
|
|
||||||
//spawn snake()
|
//spawn snake()
|
||||||
if(Math.random() < .001){
|
if(Math.random() < .0001){
|
||||||
console.log("RANDOM SNAKE!");
|
console.log("RANDOM SNAKE!");
|
||||||
this.addEnemy("Snake", this.player.position.clone().add(new Vec2(0,-320)),{
|
this.addEnemy("Snake", this.player.position.clone().add(new Vec2(0,-320)),{
|
||||||
player: this.player,
|
player: this.player,
|
||||||
health: 50,
|
health: 50,
|
||||||
tilemap: "Main",
|
tilemap: "Main",
|
||||||
goal: Statuses.REACHED_GOAL,
|
goal: Statuses.REACHED_GOAL,
|
||||||
size: new Vec2(16,16),
|
size: new Vec2(14,10),
|
||||||
offset : new Vec2(0, 16),
|
offset : new Vec2(0, 22),
|
||||||
exp: 50,
|
exp: 50,
|
||||||
actions: [new AttackAction(3, [Statuses.IN_RANGE], [Statuses.REACHED_GOAL]),
|
actions: [new AttackAction(3, [Statuses.IN_RANGE], [Statuses.REACHED_GOAL]),
|
||||||
new Move(2, [], [Statuses.IN_RANGE], {inRange: 60})],
|
new Move(2, [], [Statuses.IN_RANGE], {inRange: 60})],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user