Capitalized file reference names

This commit is contained in:
OfficialCHenry 2022-04-16 23:01:54 -04:00
parent dc74bf5424
commit 6ffa74771f
10 changed files with 368 additions and 100 deletions

View File

@ -30,13 +30,13 @@
"y": 19 "y": 19
}, },
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 7, "x": 7,
"y": 19, "y": 19,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 1, "x": 1,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
@ -80,37 +80,37 @@
], ],
"sprites": [ "sprites": [
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 1, "x": 1,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 12, "x": 12,
"y": 12, "y": 12,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 18, "x": 18,
"y": 15, "y": 15,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 14, "x": 14,
"y": 16, "y": 16,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 24, "x": 24,
"y": 17, "y": 17,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 6, "x": 6,
"y": 17, "y": 17,
"possibility": 1 "possibility": 1
@ -139,51 +139,51 @@
], ],
"sprites": [ "sprites": [
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 1, "x": 1,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 5, "x": 5,
"y": 15, "y": 14,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 14, "x": 14,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 11, "x": 11,
"y": 13, "y": 12,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 18, "x": 18,
"y": 12, "y": 12,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 23, "x": 23,
"y": 15, "y": 15,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 16, "x": 16,
"y": 17, "y": 16,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 27, "x": 27,
"y": 18, "y": 16,
"possibility": 1 "possibility": 1
} }
] ]
@ -210,37 +210,37 @@
], ],
"sprites": [ "sprites": [
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 1, "x": 1,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 5, "x": 5,
"y": 14, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 11, "x": 11,
"y": 12, "y": 12,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 12, "x": 12,
"y": 9, "y": 9,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 15, "x": 15,
"y": 15, "y": 15,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 25, "x": 25,
"y": 14, "y": 14,
"possibility": 1 "possibility": 1
@ -270,37 +270,37 @@
], ],
"sprites": [ "sprites": [
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 1, "x": 1,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 9, "x": 9,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 9, "x": 9,
"y": 5, "y": 5,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 15, "x": 15,
"y": 18, "y": 18,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 23, "x": 23,
"y": 16, "y": 16,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 27, "x": 27,
"y": 14, "y": 14,
"possibility": 1 "possibility": 1
@ -329,37 +329,37 @@
], ],
"sprites": [ "sprites": [
{ {
"type": "test_dummy", "type": "black_pudding",
"x": 1, "x": 1,
"y": 10, "y": 10,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 7, "x": 7,
"y": 13, "y": 13,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 13, "x": 13,
"y": 12, "y": 12,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 18, "x": 18,
"y": 14, "y": 14,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 13, "x": 13,
"y": 16, "y": 16,
"possibility": 1 "possibility": 1
}, },
{ {
"type": "snake", "type": "Snake",
"x": 23, "x": 23,
"y": 13, "y": 13,
"possibility": 1 "possibility": 1

View File

@ -208,7 +208,7 @@
}, },
{ {
"name": "HURT", "name": "HURT",
"repeat": true, "repeat": false,
"frames": [ "frames": [
{ {
"index": 0, "index": 0,

View File

@ -11,7 +11,7 @@
"bottomBuffer": 0, "bottomBuffer": 0,
"animations": [ "animations": [
{ {
"name": "Idle", "name": "IDLE",
"repeat": true, "repeat": true,
"frames": [ "frames": [
{ {
@ -64,6 +64,244 @@
} }
] ]
}, },
{
"name": "WALK",
"repeat": true,
"frames": [
{
"index": 60,
"duration": 4
},
{
"index": 61,
"duration": 4
},
{
"index": 62,
"duration": 4
},
{
"index": 63,
"duration": 4
},
{
"index": 64,
"duration": 4
},
{
"index": 65,
"duration": 4
},
{
"index": 66,
"duration": 4
},
{
"index": 67,
"duration": 4
},
{
"index": 68,
"duration": 4
},
{
"index": 69,
"duration": 4
}
]
},
{
"name": "ATTACK",
"repeat": true,
"frames": [
{
"index": 120,
"duration": 4
},
{
"index": 121,
"duration": 4
},
{
"index": 122,
"duration": 4
},
{
"index": 123,
"duration": 4
},
{
"index": 124,
"duration": 4
},
{
"index": 125,
"duration": 4
},
{
"index": 126,
"duration": 4
},
{
"index": 127,
"duration": 4
},
{
"index": 128,
"duration": 4
},
{
"index": 129,
"duration": 4
},
{
"index": 130,
"duration": 4
},
{
"index": 131,
"duration": 4
},
{
"index": 132,
"duration": 4
},
{
"index": 133,
"duration": 4
},
{
"index": 134,
"duration": 4
},
{
"index": 135,
"duration": 4
},
{
"index": 136,
"duration": 4
},
{
"index": 137,
"duration": 4
},
{
"index": 138,
"duration": 4
},
{
"index": 139,
"duration": 4
},
{
"index": 140,
"duration": 4
},
{
"index": 141,
"duration": 4
},
{
"index": 142,
"duration": 4
},
{
"index": 143,
"duration": 4
},
{
"index": 144,
"duration": 4
},
{
"index": 145,
"duration": 4
},
{
"index": 146,
"duration": 4
},
{
"index": 147,
"duration": 4
},
{
"index": 148,
"duration": 4
},
{
"index": 149,
"duration": 4
}
]
},
{
"name": "HURT",
"repeat": false,
"frames": [
{
"index": 180,
"duration": 4
},
{
"index": 181,
"duration": 4
},
{
"index": 182,
"duration": 4
},
{
"index": 183,
"duration": 4
},
{
"index": 184,
"duration": 4
},
{
"index": 185,
"duration": 4
},
{
"index": 186,
"duration": 4
},
{
"index": 187,
"duration": 4
},
{
"index": 188,
"duration": 4
},
{
"index": 189,
"duration": 4
},
{
"index": 190,
"duration": 4
},
{
"index": 191,
"duration": 4
},
{
"index": 192,
"duration": 4
},
{
"index": 193,
"duration": 4
},
{
"index": 194,
"duration": 4
}
]
},
{ {
"name": "Moving Left", "name": "Moving Left",
"repeat": true, "repeat": true,
@ -541,7 +779,7 @@
] ]
}, },
{ {
"name": "Dying", "name": "DYING",
"repeat": false, "repeat": false,
"frames": [ "frames": [
{ {
@ -587,7 +825,7 @@
] ]
}, },
{ {
"name": "Dead", "name": "DEAD",
"repeat": false, "repeat": false,
"frames": [ "frames": [
{ {

View File

@ -11,3 +11,5 @@ export default interface BattlerAI extends AI {
damage: (damage: number) => void; damage: (damage: number) => void;
} }

View File

@ -108,7 +108,7 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
damage(damage: number): void { damage(damage: number): void {
this.CURRENT_HP -= damage; this.CURRENT_HP -= damage;
//TODO - //TODO -
this.owner.animation.play("HURT"); this.owner.animation.play("HURT",false);
console.log(damage +" damage taken, "+this.CURRENT_HP+" hp left"); console.log(damage +" damage taken, "+this.CURRENT_HP+" hp left");
// If we're low enough, add Low Health status to enemy // If we're low enough, add Low Health status to enemy

View File

@ -1,27 +0,0 @@
import GameEvent from "../../../Wolfie2D/Events/GameEvent";
import Input from "../../../Wolfie2D/Input/Input";
import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite";
import MathUtils from "../../../Wolfie2D/Utils/MathUtils";
import EnemyState from "./EnemyState";
export default class OnGround extends EnemyState {
onEnter(options: Record<string, any>): void {}
update(deltaT: number): void {
if(this.parent.velocity.y > 0){
this.parent.velocity.y = 0;
}
super.update(deltaT);
this.finished("fall");
}
handleInput(event: GameEvent): void { }
onExit(): Record<string, any> {
return {};
}
}

View File

@ -7,7 +7,6 @@ import EnemyAI, { EnemyStates } from "../EnemyAI";
import EnemyState from "./EnemyState"; import EnemyState from "./EnemyState";
import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite"; import Sprite from "../../../Wolfie2D/Nodes/Sprites/Sprite";
import MathUtils from "../../../Wolfie2D/Utils/MathUtils"; import MathUtils from "../../../Wolfie2D/Utils/MathUtils";
import OnGround from "./OnGround";
import AnimatedSprite from "../../../Wolfie2D/Nodes/Sprites/AnimatedSprite"; import AnimatedSprite from "../../../Wolfie2D/Nodes/Sprites/AnimatedSprite";
export default class Patrol extends EnemyState { export default class Patrol extends EnemyState {

View File

@ -68,21 +68,19 @@ export default class PlayerController extends StateMachineAI implements BattlerA
BASE_DEF: number = 100; BASE_DEF: number = 100;
MAX_DEF: number = 100; MAX_DEF: number = 100;
CURRENT_DEF: number = 100; CURRENT_DEF: number = 100;
CURRENT_EXP : number = 0;
MAX_EXP : number = 100;
invincible : boolean = false;
tilemap: OrthogonalTilemap; tilemap: OrthogonalTilemap;
//for doublejumps maybe = # of jumps in air allowed //for doublejumps maybe = # of jumps in air allowed
MAX_airjumps: number = 1; MAX_airjumps: number = 1;
airjumps:number = 0; airjumps:number = 0;
// TODO -
damage(damage: number): void {
(<AnimatedSprite>this.owner).animation.play("HURT", false);
this.CURRENT_HP -= damage;
}
private lookDirection: Vec2; private lookDirection: Vec2;
/** A list of items in the game world */ /** A list of items in the game world */
private items: Array<Item>; private items: Array<Item>;
@ -98,6 +96,13 @@ export default class PlayerController extends StateMachineAI implements BattlerA
} }
// TODO -
damage(damage: number): void {
if( !this.invincible){
(<AnimatedSprite>this.owner).animation.play("HURT", false);
this.CURRENT_HP -= damage;
}
}
/** /**
* Returns three legal random generate buffs based on current state * Returns three legal random generate buffs based on current state
@ -108,14 +113,18 @@ export default class PlayerController extends StateMachineAI implements BattlerA
return undefined; return undefined;
} }
//TODO - balance buff value generation
//generate array of 3 different buffs
/** /**
* generate array of 3 buffs * returns an array of three randomly generated buffs
* @returns array of 3 differently typed buffs * @param val optional value to give buff
* @returns array of three Buffs
*/ */
static generateBuffs() : Buff[]{ static generateBuffs( val? : number) : Buff[]{
let num = Number(Math.random().toPrecision(1)) * 10; //number from 1 to 10 let num = Number(Math.random().toPrecision(1)) * 10; //random number from 1 to 10 if no value given
if(typeof val !== 'undefined'){
num = val;
}
let array : Buff[] = [ let array : Buff[] = [
{type:BuffType.ATK, value:num}, {type:BuffType.ATK, value:num},
{type:BuffType.HEALTH, value:num}, {type:BuffType.HEALTH, value:num},
@ -155,9 +164,11 @@ export default class PlayerController extends StateMachineAI implements BattlerA
break; break;
case BuffType.SPEED: case BuffType.SPEED:
this.CURRENT_BUFFS.speed += buff.value; this.CURRENT_BUFFS.speed += buff.value;
this.speed += buff.value;
break; break;
case BuffType.DEF: case BuffType.DEF:
this.CURRENT_BUFFS.def += buff.value; this.CURRENT_BUFFS.def += 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;
@ -241,9 +252,9 @@ export default class PlayerController extends StateMachineAI implements BattlerA
} }
} }
} }
} }

View File

@ -87,6 +87,11 @@ export default class GameLevel extends Scene {
//can load player sprite here //can load player sprite here
//can load enemy sprite here //can load enemy sprite here
//sprites obtained from cse380 sprite wesbite
this.load.spritesheet("Tiger","shattered_sword_assets/spritesheets/Tiger.json");
this.load.spritesheet("remus_werewolf","shattered_sword_assets/spritesheets/remus_werewolf.json");
this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json");
// Load the scene info // Load the scene info
this.load.object("weaponData", "shattered_sword_assets/data/weaponData.json"); this.load.object("weaponData", "shattered_sword_assets/data/weaponData.json");
@ -489,12 +494,29 @@ export default class GameLevel extends Scene {
let enemy = this.add.animatedSprite(spriteKey, "primary"); let enemy = this.add.animatedSprite(spriteKey, "primary");
//enemy.position.set(tilePos.x*32, tilePos.y*32); //enemy.position.set(tilePos.x*32, tilePos.y*32);
enemy.position.copy(tilePos); enemy.position.copy(tilePos);
enemy.scale.set(2, 2);
//TODO - add custom collision shape for each enemy in an option variable
//enemy.addPhysics(aiOptions.size.clone());
enemy.addPhysics(new AABB(Vec2.ZERO, new Vec2(16, 25))); if( "scale" in aiOptions){
enemy.colliderOffset.set(0, 6); enemy.scale.set(aiOptions.scale,aiOptions.scale);
}
else{
enemy.scale.set(2, 2);
}
//TODO - add custom collision shape for each enemy in an option variable
if( "size" in aiOptions){
enemy.addPhysics(new AABB(Vec2.ZERO, aiOptions.size.clone()));
}
else{
enemy.addPhysics(new AABB(Vec2.ZERO, new Vec2(16, 25)));
}
if("offset" in aiOptions){
enemy.colliderOffset.set(aiOptions.offset.x,aiOptions.offset.y);
}
else{
enemy.colliderOffset.set(0, 6);
}
enemy.addAI(EnemyAI, aiOptions); //TODO - add individual enemy AI enemy.addAI(EnemyAI, aiOptions); //TODO - add individual enemy AI
enemy.setGroup("Enemy"); enemy.setGroup("Enemy");
@ -519,17 +541,19 @@ export default class GameLevel extends Scene {
//size: new AABB(Vec2.ZERO, new Vec2(16, 25)) //size: new AABB(Vec2.ZERO, new Vec2(16, 25))
}) })
break; break;
case "snake": //snake enemies drop from sky("trees")? or could just be very abundant case "Snake": //Snake enemies drop from sky("trees")? or could just be very abundant
this.addEnemy("snake", enemy.position.scale(32), { this.addEnemy("Snake", enemy.position.scale(32), {
player: this.player, player: this.player,
health: 50, health: 50,
tilemap: "Main", tilemap: "Main",
//actions:actions, //actions:actions,
goal: Statuses.REACHED_GOAL, goal: Statuses.REACHED_GOAL,
size: new Vec2(16,16),
offset : new Vec2(0, 16)
}) })
break; break;
case "tiger": //tiger can be miniboss for now? case "Tiger": //Tiger can be miniboss for now?
this.addEnemy("tiger", enemy.position.scale(32), { this.addEnemy("Tiger", enemy.position.scale(32), {
player: this.player, player: this.player,
health: 200, health: 200,
tilemap: "Main", tilemap: "Main",
@ -538,6 +562,27 @@ export default class GameLevel extends Scene {
}) })
break; break;
case "remus_werewolf":
this.addEnemy("remus_werewolf", enemy.position.scale(32), {
player: this.player,
health: 200,
tilemap: "Main",
//actions:actions,
goal: Statuses.REACHED_GOAL,
})
break;
case "black_pudding":
this.addEnemy("black_pudding", enemy.position.scale(32), {
player: this.player,
health: 200,
tilemap: "Main",
//actions:actions,
goal: Statuses.REACHED_GOAL,
scale: .25,
size: new Vec2(16,16),
offset : new Vec2(0,0)
})
break;
default: default:
break; break;
} }

View File

@ -33,8 +33,8 @@ export default class Tutorial extends GameLevel {
this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json"); this.load.spritesheet("slice", "shattered_sword_assets/spritesheets/slice.json");
//load enemies //load enemies
this.load.spritesheet("snake","shattered_sword_assets/spritesheets/snake.json"); this.load.spritesheet("Snake","shattered_sword_assets/spritesheets/Snake.json");
this.load.spritesheet("tiger","shattered_sword_assets/spritesheets/tiger.json"); this.load.spritesheet("Tiger","shattered_sword_assets/spritesheets/Tiger.json");