Merge remote-tracking branch 'github/master'

This commit is contained in:
Renge 2022-04-24 18:19:01 -04:00
commit 201bfccd85
7 changed files with 86 additions and 59 deletions

View File

@ -38,18 +38,6 @@
"type": "player",
"x": 5,
"y": 19
},
{
"type": "black_pudding",
"x": 7,
"y": 19,
"possibility": 1
},
{
"type": "Snake",
"x": 1,
"y": 10,
"possibility": 1
}
],
"startCheckPoint": [25, 19, 5, 5]

Binary file not shown.

View File

@ -3,7 +3,7 @@
"spriteSheetImage": "Hiro.png",
"spriteWidth": 64,
"spriteHeight": 64,
"columns": 7,
"columns": 8,
"rows": 7,
"durationType": "time",
"animations": [
@ -75,12 +75,12 @@
]
},
{
"name": "JUMP",
"name": "JUMP2",
"repeat": false,
"frames": [
{
"index": 30,
"duration": 10
"duration": 5
},
{
"index": 31,
@ -96,12 +96,12 @@
},
{
"index": 30,
"duration": 10
"duration": 5
}
]
},
{
"name": "JUMP_RIGHT",
"name": "JUMP",
"repeat": false,
"frames": [
{
@ -303,6 +303,32 @@
"duration": 10
}
]
},
{
"name": "DASH",
"repeat": false,
"frames": [
{
"index": 46,
"duration": 5
},
{
"index": 47,
"duration": 5
},
{
"index": 48,
"duration": 5
},
{
"index": 49,
"duration": 5
},
{
"index": 50,
"duration": 10
}
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -282,21 +282,6 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
}
//TODO - GOAP NOT WORKING, ATTACK WORKAROUND
if(this.getPlayerPosition() == null){
return;
}
let distance = this.owner.position.distanceTo(this.getPlayerPosition());
if( distance <= 20){
if( this.direction == Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){
let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize();
if(this.attackTimer.isStopped()){
this.weapon.use(this.owner, "enemy", dir.scale(1,0))
this.attackTimer.start();
}
}
}

View File

@ -361,13 +361,14 @@ export default class PlayerController extends StateMachineAI implements BattlerA
dotBuffs.push({type:BuffType.POISON, value:1, category: BuffCategory.DOT, string: "Your hits \napply poison"});
}
if(dotBuffs.length < 3){ //only add extra dot if at least one dot is acquired
//only add extra dot if at least one dot is acquired
for(let i=dotBuffs.length; i< 3 ; i++){
dotBuffs.push({type:BuffType.EXTRA_DOT, value:num, category: BuffCategory.DOT, string: "increase your \nDOT damage"});
}
let shieldBuffs : Buff[] = [
{type:BuffType.HEALTH, value:1, category: BuffCategory.SHIELD},
{type:BuffType.HEALTH, value:num, category: BuffCategory.SHIELD},
];
//if player doesnt have shield buff, give them the option, otherwise give buff shield option
if(!this.hasShield){
@ -405,23 +406,48 @@ export default class PlayerController extends StateMachineAI implements BattlerA
switch(cat){
case BuffCategory.ATTACK:
attackBuffs.sort(() => 0.5 - Math.random());
selected.push(attackBuffs.pop());
if(attackBuffs.length == 0){
selected.push({type:BuffType.RANGE, value:num/10, category: BuffCategory.ATTACK});
}
else{
selected.push(attackBuffs.pop());
}
break;
case BuffCategory.DOT:
dotBuffs.sort(() => 0.5 - Math.random());
selected.push(dotBuffs.pop());
if(dotBuffs.length == 0){
selected.push({type:BuffType.EXTRA_DOT, value:num, category: BuffCategory.DOT, string: "increase your \nDOT damage"});
}
else{
selected.push(dotBuffs.pop());
}
break;
case BuffCategory.EXTRA:
extraBuffs.sort(() => 0.5 - Math.random());
selected.push(extraBuffs.pop());
if(extraBuffs.length ==0 ){
selected.push({type:BuffType.EXTRALIFE, value:1, category: BuffCategory.EXTRA, string: "Gain an \nExtra Life"});
}
else{
selected.push(extraBuffs.pop());
}
break;
case BuffCategory.HEALTH:
healthBuffs.sort(() => 0.5 - Math.random());
selected.push(healthBuffs.pop());
if(healthBuffs.length == 0){
selected.push({type:BuffType.DEF, value: num/10, category: BuffCategory.HEALTH, string: "decrease damage\n taken by "+num*10+"%"});
}
else{
selected.push(healthBuffs.pop());
}
break;
case BuffCategory.SHIELD:
shieldBuffs.sort(() => 0.5 - Math.random());
selected.push(shieldBuffs.pop());
if(shieldBuffs.length ==0 ){
selected.push({type:BuffType.HEALTH, value:num, category: BuffCategory.SHIELD});
}
else{
selected.push(shieldBuffs.pop());
}
break;
}
}
@ -519,11 +545,17 @@ export default class PlayerController extends StateMachineAI implements BattlerA
*/
getStats(): Record<string, any>{
let stats = {} as Record<string,any>;
stats.current_health = this.CURRENT_HP;
stats.CURRENT_HP = this.CURRENT_HP;
stats.CURRENT_ATK = this.CURRENT_ATK;
stats.CURRENT_SHIELD = this.CURRENT_SHIELD;
stats.CURRENT_EXP = this.CURRENT_EXP;
return
}
toString(): string{
return "";
}
}

View File

@ -158,6 +158,7 @@ export default class GameLevel extends Scene {
this.load.audio("hurt", "shattered_sword_assets/sounds/hurt.wav");
this.load.audio("die", "shattered_sword_assets/sounds/die.wav");
this.load.audio("level_up","shattered_sword_assets/sounds/level_up.wav");
this.load.audio("level_music","shattered_sword_assets/sounds/bgm1.mp3")
this.load.image("knife", "shattered_sword_assets/sprites/knife.png");
@ -251,12 +252,11 @@ export default class GameLevel extends Scene {
this.levelTransitionScreen.tweens.play("fadeOut");
*/
//TODO - uncomment when done testing
// Initially disable player movement
//Input.disableInput();
this.gameStateStack = new Stack();
this.setGameState(GameState.GAMING);
InputWrapper.enableInput();
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "level_music", loop: true, holdReference: true});
}
@ -321,27 +321,25 @@ export default class GameLevel extends Scene {
case Player_Events.GIVE_BUFF:
this.buffs = (<PlayerController>this.player._ai).generateBuffs();
if(this.buffs[0].string !== undefined){
//this.buffButton1.text = this.buffs[0].string;
this.buffLabel1.text = this.buffs[0].string;
}
else{
//this.buffButton1.text = "Increase "+this.buffs[0].type + " by "+this.buffs[0].value;
if(this.buffs[0].string === undefined){
this.buffLabel1.text = "Increase "+this.buffs[0].type + "\n by \n"+this.buffs[0].value;
}
if(this.buffs[1].string !== undefined){
this.buffLabel2.text = this.buffs[1].string;
}
else{
this.buffLabel1.text = this.buffs[0].string;
}
if(this.buffs[1].string === undefined){
this.buffLabel2.text = "Increase "+this.buffs[1].type + "\n by \n"+this.buffs[1].value;
}
else{
this.buffLabel2.text = this.buffs[1].string;
}
if(this.buffs[2].string !== undefined){
this.buffLabel3.text = this.buffs[2].string;
if(this.buffs[2].string === undefined){
this.buffLabel3.text = "Increase "+this.buffs[2].type + "\n by \n"+this.buffs[2].value;
}
else{
this.buffLabel3.text = "Increase "+this.buffs[2].type + "\n by \n"+this.buffs[2].value;
this.buffLabel3.text = this.buffs[2].string;
}
//pause game here
@ -998,8 +996,6 @@ export default class GameLevel extends Scene {
//damage the player
(<PlayerController>this.player._ai).damage(10); //10 collision dmg for now
}
}