Merge remote-tracking branch 'github/master'

This commit is contained in:
Renge 2022-05-09 13:56:16 -04:00
commit e8bcf455eb
18 changed files with 392 additions and 110 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,56 @@
{
"texts": [
{
"speaker": "",
"content": "Press enter or space or J or X to continue",
"actions": [
{
"type": "loadSprite",
"key": "storymode",
"path": "shattered_sword_assets/images/guide0.png",
"positon": [
300,
150
],
"scale": [
3,
3
]
}
]
},
{
"speaker": "",
"content": "There're bulls and slimes in the great wall. Hint: the bull will dash when attack.",
"actions": [
{
"type": "hideSprite",
"key": "storymode"
},
{
"type": "loadSprite",
"key": "enemies",
"path": "shattered_sword_assets/images/wall_story1.png",
"positon": [
300,
150
],
"scale": [
3,
3
]
}
]
},
{
"speaker": "",
"content": "Good luck on your journey!",
"actions": [
{
"type": "hideSprite",
"key": "enemies"
}
]
}
]
}

View File

@ -0,0 +1,61 @@
{
"texts": [
{
"speaker": "",
"content": "Press enter or space or J or X to continue",
"actions": [
{
"type": "loadSprite",
"key": "storymode",
"path": "shattered_sword_assets/images/guide0.png",
"positon": [
300,
150
],
"scale": [
3,
3
]
}
]
},
{
"speaker": "",
"content": "We're now in a snow mountain. There're archers and slimes in the mountain.",
"actions": [
{
"type": "hideSprite",
"key": "storymode"
},
{
"type": "loadSprite",
"key": "enemies",
"path": "shattered_sword_assets/images/snow_story1.png",
"positon": [
300,
150
],
"scale": [
3,
3
]
}
]
},
{
"speaker": "",
"content": "Hint: jump when under attack!",
"actions": []
},
{
"speaker": "",
"content": "Good luck on your journey!",
"actions": [
{
"type": "hideSprite",
"key": "enemies"
}
]
}
]
}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because one or more lines are too long

View File

@ -15,14 +15,20 @@ export default class AssassinAttack extends Attack {
onEnter(options: Record<string, any>): void { onEnter(options: Record<string, any>): void {
super.onEnter(options); super.onEnter(options);
this.runTimer = new Timer(500); this.runTimer = new Timer(500);
this.pauseTimer = new Timer(1000); this.pauseTimer = new Timer(1500);
this.owner.alpha = 1; //unstealth to attack this.owner.alpha = 1; //unstealth to attack
this.startPosition = this.owner.position; this.startPosition = this.owner.position;
//look around
(<Sprite>this.owner).invertX != (<Sprite>this.owner).invertX;
(<Sprite>this.owner).invertX != (<Sprite>this.owner).invertX;
(<Sprite>this.owner).invertX != (<Sprite>this.owner).invertX;
(<Sprite>this.owner).invertX != (<Sprite>this.owner).invertX;
if(this.parent.getPlayerPosition() !==null) if(this.parent.getPlayerPosition() !==null)
this.owner.position = this.parent.getPlayerPosition().clone().add(new Vec2( (<Sprite>this.parent.player).invertX ? 64 : -64 ,0)); this.owner.position = this.parent.getPlayerPosition().clone().add(new Vec2( (<Sprite>this.parent.player).invertX ? 56 : -56 ,0));
this.pauseTimer.start(); this.pauseTimer.start();
@ -55,8 +61,17 @@ export default class AssassinAttack extends Attack {
} }
this.parent.velocity.x = this.parent.direction * 500; this.parent.velocity.x = this.parent.direction * 500;
(<Sprite>this.owner).invertX = this.parent.direction === 1 ? true : false ; (<Sprite>this.owner).invertX = this.parent.direction === 1 ? true : false ;
super.update(deltaT); //no gravity for assassin
} if (!this.parent.damageTimer.isStopped() && !this.parent.isAttacking && !this.parent.isCharging) {
this.parent.velocity.x = 0;
}
// Do gravity
if (this.owner.onGround) {
this.parent.velocity.y = 0;
}
this.owner.move(this.parent.velocity.scaled(deltaT));
}

View File

@ -24,12 +24,14 @@ export default class BossAttack extends Attack {
this.owner.alpha = 1; //unstealth to attack this.owner.alpha = 1; //unstealth to attack
switch( this.atknum){ switch( this.atknum){
case 0: //archer atk case 0: //archer atk
console.log("archer atk");
this.pauseTimer = new Timer(1000); this.pauseTimer = new Timer(1000);
this.pauseTimer.start(); this.pauseTimer.start();
break; break;
case 1: //assassin atk case 1: //assassin atk
console.log("assassin atk");
this.runTimer = new Timer(500); this.runTimer = new Timer(500);
this.pauseTimer = new Timer(1000); this.pauseTimer = new Timer(1500);
this.startPosition = this.owner.position; this.startPosition = this.owner.position;
if(this.parent.getPlayerPosition() !==null) if(this.parent.getPlayerPosition() !==null)
this.owner.position = this.parent.getPlayerPosition().clone().add(new Vec2( (<Sprite>this.parent.player).invertX ? 64 : -64 ,0)); this.owner.position = this.parent.getPlayerPosition().clone().add(new Vec2( (<Sprite>this.parent.player).invertX ? 64 : -64 ,0));
@ -37,12 +39,15 @@ export default class BossAttack extends Attack {
this.pauseTimer.start(); this.pauseTimer.start();
break; break;
case 2: //bull atk case 2: //bull atk
console.log("bull atk");
this.runTimer = new Timer(2000); this.runTimer = new Timer(2000);
break; break;
case 3: //tiger atk case 3: //tiger atk
console.log("tiger atk");
this.velocity = 0; this.velocity = 0;
break; break;
case 4: //snake atk case 4: //snake atk
console.log("snake atk");
break; break;
default: default:
break; break;

View File

@ -75,7 +75,7 @@ export default class Weapon extends Item {
// Reset the cooldown timer // Reset the cooldown timer
this.cooldownTimer.start(); this.cooldownTimer.start();
//TODO - may have to move elsewhere //TODO - may have to move elsewhere
this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "sword", loop: false, holdReference: false}); //this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "sword", loop: false, holdReference: false});
return true; return true;
} }

View File

@ -190,6 +190,12 @@ export default class PlayerController extends StateMachineAI implements BattlerA
} }
static reset(){
this.appliedBuffs = new Array();
this.buffPool = new Array();
this.enemiesKilled = 0;
}
initializePlatformer(): void { initializePlatformer(): void {
this.speed = 400; this.speed = 400;
@ -241,8 +247,8 @@ export default class PlayerController extends StateMachineAI implements BattlerA
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
if (item) { if (item) {
item.use(this.owner, "player", this.lookDirection); if((<Weapon>item).use(this.owner, "player", this.lookDirection))
//this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "sword", loop: false, holdReference: false}); this.emitter.fireEvent(GameEventType.PLAY_SOUND, {key: "sword", loop: false, holdReference: false});
} }
} }

View File

@ -16,7 +16,7 @@ export default class Idle extends OnGround {
//("idle anim"); //("idle anim");
if (!PlayerState.dashTimer.isStopped()) { if (!PlayerState.dashTimer.isStopped()) {
console.log("Playing dash"); //console.log("Playing dash");
this.owner.animation.playIfNotAlready("DASH"); this.owner.animation.playIfNotAlready("DASH");
} }
else { else {

View File

@ -23,6 +23,7 @@ import EnemyAI from "../AI/EnemyAI";
import SnakeAI from "../AI/SnakeAI"; import SnakeAI from "../AI/SnakeAI";
import SlimeAI from "../AI/SlimeAI"; import SlimeAI from "../AI/SlimeAI";
import TigerAI from "../AI/TigerAI"; import TigerAI from "../AI/TigerAI";
import BullAI from "../AI/BullAI";
import ArcherAI from "../AI/ArcherAI"; import ArcherAI from "../AI/ArcherAI";
import AssassinAI from "../AI/AssassinAI"; import AssassinAI from "../AI/AssassinAI";
import BattlerAI from "../AI/BattlerAI"; import BattlerAI from "../AI/BattlerAI";
@ -43,7 +44,7 @@ import GameOver from "./GameOver";
import GameFinish from "./GameFinish"; import GameFinish from "./GameFinish";
import MainMenu from "./MainMenu"; import MainMenu from "./MainMenu";
import MapTemplate from "../Tools/DataTypes/MapTemplate"; import MapTemplate from "../Tools/DataTypes/MapTemplate";
import BullAI from "../AI/BullAI"; import BossAI from "../AI/BossAI";
// TODO // TODO
/** /**
@ -880,18 +881,19 @@ export default class GameLevel extends Scene {
switch (enemy.type) { switch (enemy.type) {
/* /*
case "Archer": case "Snake":
this.addEnemy("Archer", enemy.position.scale(32), ArcherAI, { this.addEnemy("Snake", enemy.position.scale(32), BossAI, {
player: this.player, player: this.player,
health: 50, health: 50,
tilemap: "Main", tilemap: "Main",
size: new Vec2(14,10), size: new Vec2(14,10),
offset : new Vec2(0, 22), offset : new Vec2(0, 22),
exp: 50, exp: 50,
weapon: this.createWeapon("pistol"); weapon: this.createWeapon("laserGun")
}) })
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), SnakeAI, { this.addEnemy("Snake", enemy.position.scale(32), SnakeAI, {
player: this.player, player: this.player,
@ -902,7 +904,7 @@ export default class GameLevel extends Scene {
exp: 50, exp: 50,
}) })
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), TigerAI, { this.addEnemy("Tiger", enemy.position.scale(32), TigerAI, {
player: this.player, player: this.player,
@ -939,6 +941,42 @@ export default class GameLevel extends Scene {
weapon : this.createWeapon("knife"), weapon : this.createWeapon("knife"),
}) })
break; break;
case "Bull":
this.addEnemy("Bull", enemy.position.scale(32), BullAI, {
player: this.player,
health: 150,
tilemap: "Main",
//actions:actions,
scale: 1.5,
size: new Vec2(48,24),
offset : new Vec2(0,24),
exp: 75,
})
break;
case "Archer":
this.addEnemy("Archer", enemy.position.scale(32), ArcherAI, {
player: this.player,
health: 100,
tilemap: "Main",
scale: 1,
size: new Vec2(20,16),
offset : new Vec2(0,16),
exp: 75,
weapon: this.createWeapon("pistol")
})
break;
case "Assassin":
this.addEnemy("Assassin", enemy.position.scale(32), AssassinAI, {
player: this.player,
health: 100,
tilemap: "Main",
scale: 1,
size: new Vec2(20,16),
offset : new Vec2(0,16),
exp: 75,
})
break;
default: default:
break; break;
} }

View File

@ -23,8 +23,13 @@ export default class Greatwall extends GameLevel {
this.load.tilemapFromObject("map", this.map); this.load.tilemapFromObject("map", this.map);
//load enemies //load enemies
this.load.spritesheet("Bull","shattered_sword_assets/spritesheets/Bull.json");
//can load enemy sprite here
//sprites obtained from cse380 sprite wesbite
this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json"); this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json");
this.load.spritesheet("Bull","shattered_sword_assets/spritesheets/Bull.json");
//load music here
} }
protected goToNextLevel(): void { protected goToNextLevel(): void {
this.viewport.setZoomLevel(1); this.viewport.setZoomLevel(1);
@ -45,7 +50,7 @@ export default class Greatwall extends GameLevel {
protected playStartStory(): void { protected playStartStory(): void {
if (!this.touchedStartCheckPoint) { if (!this.touchedStartCheckPoint) {
this.touchedStartCheckPoint = true; this.touchedStartCheckPoint = true;
this.storyLoader("shattered_sword_assets/jsons/level1story.json"); this.storyLoader("shattered_sword_assets/jsons/level3story.json");
this.startTimer(); this.startTimer();
} }
} }

View File

@ -16,6 +16,7 @@ import InputWrapper from "../Tools/InputWrapper";
import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput"; import TextInput from "../../Wolfie2D/Nodes/UIElements/TextInput";
import Forest from "./Forest"; import Forest from "./Forest";
import Start from "./Start"; import Start from "./Start";
import PlayerController from "../Player/PlayerController";
export default class MainMenu extends Scene { export default class MainMenu extends Scene {
protected config: ConfigManager; protected config: ConfigManager;
@ -39,6 +40,7 @@ export default class MainMenu extends Scene {
GameLevel.gameTimer = 0; GameLevel.gameTimer = 0;
InputWrapper.randomSeed = undefined; InputWrapper.randomSeed = undefined;
const center = this.viewport.getCenter(); const center = this.viewport.getCenter();
PlayerController.reset();
// The main menu // The main menu
this.mainMenu = this.addUILayer("mainMenu"); this.mainMenu = this.addUILayer("mainMenu");

View File

@ -27,7 +27,7 @@ export default class Market extends GameLevel {
//can load enemy sprite here //can load enemy sprite here
//sprites obtained from cse380 sprite wesbite //sprites obtained from cse380 sprite wesbite
// this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json"); // this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json");
this.load.spritesheet("Assassin","shattered_sword_assets/spritesheets/Assassin.json");
//load music here //load music here
} }
protected goToNextLevel(): void { protected goToNextLevel(): void {

View File

@ -27,8 +27,8 @@ export default class Snow extends GameLevel {
//can load enemy sprite here //can load enemy sprite here
//sprites obtained from cse380 sprite wesbite //sprites obtained from cse380 sprite wesbite
// this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json"); this.load.spritesheet("black_pudding","shattered_sword_assets/spritesheets/black_pudding.json");
this.load.spritesheet("Archer","shattered_sword_assets/spritesheets/Archer.json");
//load music here //load music here
} }
@ -51,7 +51,7 @@ export default class Snow extends GameLevel {
protected playStartStory(): void { protected playStartStory(): void {
if (!this.touchedStartCheckPoint) { if (!this.touchedStartCheckPoint) {
this.touchedStartCheckPoint = true; this.touchedStartCheckPoint = true;
this.storyLoader("shattered_sword_assets/jsons/level1story.json"); this.storyLoader("shattered_sword_assets/jsons/level4story.json");
this.startTimer(); this.startTimer();
} }
} }