Skip to content

Commit

Permalink
Merge pull request #103 from neki-dev/develop
Browse files Browse the repository at this point in the history
Update to 1.18.4
  • Loading branch information
neki-dev authored Nov 6, 2023
2 parents e1fc0a8 + 9fef371 commit 90209da
Show file tree
Hide file tree
Showing 48 changed files with 536 additions and 481 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.git
.vscode
.idea
node_modules/
dist/
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "izowave",
"description": "Isometric game. Build and defense in open world",
"version": "1.18.3",
"version": "1.18.4",
"keywords": [
"game",
"isometric",
Expand Down
4 changes: 2 additions & 2 deletions src/const/langs/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const EN = {
BUILDING_DESCRIPTION_TOWER_FROZEN: 'Freezes enemies for some time',
BUILDING_NAME_TOWER_LAZER: 'Laser tower',
BUILDING_DESCRIPTION_TOWER_LAZER: 'Instant and continuous laser attack of enemies',
BUILDING_NAME_ELECTRO: 'Electro tower',
BUILDING_DESCRIPTION_ELECTRO: 'Mass electric shock',
BUILDING_NAME_TOWER_ELECTRO: 'Electro tower',
BUILDING_DESCRIPTION_TOWER_ELECTRO: 'Mass electric shock',
BUILDING_NAME_GENERATOR: 'Generator',
BUILDING_DESCRIPTION_GENERATOR: 'Generates resources for builds and upgrades',
BUILDING_NAME_AMMUNITION: 'Ammunition',
Expand Down
4 changes: 2 additions & 2 deletions src/const/langs/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const ES = {
BUILDING_DESCRIPTION_TOWER_FROZEN: 'Congela a los enemigos durante algún tiempo',
BUILDING_NAME_TOWER_LAZER: 'Torre laser',
BUILDING_DESCRIPTION_TOWER_LAZER: 'Ataque de láser instantáneo y continuo de los enemigos',
BUILDING_NAME_ELECTRO: 'Torre electrica',
BUILDING_DESCRIPTION_ELECTRO: 'Ataque masivo de electricidad',
BUILDING_NAME_TOWER_ELECTRO: 'Torre electrica',
BUILDING_DESCRIPTION_TOWER_ELECTRO: 'Ataque masivo de electricidad',
BUILDING_NAME_GENERATOR: 'Generador',
BUILDING_DESCRIPTION_GENERATOR: 'Genera recursos para construcciones y mejoras',
BUILDING_NAME_AMMUNITION: 'Municion',
Expand Down
4 changes: 2 additions & 2 deletions src/const/langs/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const FR = {
BUILDING_DESCRIPTION_TOWER_FROZEN: 'Gèle les ennemis pendant un certain temps',
BUILDING_NAME_TOWER_LAZER: 'Tour laser',
BUILDING_DESCRIPTION_TOWER_LAZER: 'Attaque au laser instantanée et continue des ennemis',
BUILDING_NAME_ELECTRO: 'Tour electrique',
BUILDING_DESCRIPTION_ELECTRO: 'Attaque électrique de masse',
BUILDING_NAME_TOWER_ELECTRO: 'Tour electrique',
BUILDING_DESCRIPTION_TOWER_ELECTRO: 'Attaque électrique de masse',
BUILDING_NAME_GENERATOR: 'Generateur',
BUILDING_DESCRIPTION_GENERATOR: 'Génère des ressources pour les constructions',
BUILDING_NAME_AMMUNITION: 'Munitions',
Expand Down
4 changes: 2 additions & 2 deletions src/const/langs/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const RU = {
BUILDING_DESCRIPTION_TOWER_FROZEN: 'Замедление врагов',
BUILDING_NAME_TOWER_LAZER: 'Лазерная башня',
BUILDING_DESCRIPTION_TOWER_LAZER: 'Моментальная лазерная атака врагов',
BUILDING_NAME_ELECTRO: 'Электро башня',
BUILDING_DESCRIPTION_ELECTRO: 'Массовая атака электричеством',
BUILDING_NAME_TOWER_ELECTRO: 'Электро башня',
BUILDING_DESCRIPTION_TOWER_ELECTRO: 'Массовая атака электричеством',
BUILDING_NAME_GENERATOR: 'Генератор',
BUILDING_DESCRIPTION_GENERATOR: 'Генерация ресурсов для построек',
BUILDING_NAME_AMMUNITION: 'Амуниция',
Expand Down
18 changes: 9 additions & 9 deletions src/const/world/difficulty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ export const DIFFICULTY = {
* Building: Tower: Electro
*/

BUILDING_ELECTRO_COST: 120, // Building cost
BUILDING_ELECTRO_HEALTH: 400, // Health
BUILDING_ELECTRO_ALLOW_BY_WAVE: 15, // Minimal wave for allow build
BUILDING_ELECTRO_RADIUS: 90, // Attack radius
BUILDING_ELECTRO_RADIUS_GROWTH: 0.15, // Radius growth by level (Linear)
BUILDING_ELECTRO_DELAY: 1500, // Pause between attacks
BUILDING_ELECTRO_DELAY_GROWTH: -0.1, // Pause growth by level (Linear)
BUILDING_ELECTRO_DAMAGE: 110, // Attack damage
BUILDING_ELECTRO_DAMAGE_GROWTH: 0.9, // Damage growth by level (Linear)
BUILDING_TOWER_ELECTRO_COST: 120, // Building cost
BUILDING_TOWER_ELECTRO_HEALTH: 400, // Health
BUILDING_TOWER_ELECTRO_ALLOW_BY_WAVE: 15, // Minimal wave for allow build
BUILDING_TOWER_ELECTRO_RADIUS: 90, // Attack radius
BUILDING_TOWER_ELECTRO_RADIUS_GROWTH: 0.15, // Radius growth by level (Linear)
BUILDING_TOWER_ELECTRO_DELAY: 1500, // Pause between attacks
BUILDING_TOWER_ELECTRO_DELAY_GROWTH: -0.1, // Pause growth by level (Linear)
BUILDING_TOWER_ELECTRO_DAMAGE: 110, // Attack damage
BUILDING_TOWER_ELECTRO_DAMAGE_GROWTH: 0.8, // Damage growth by level (Linear)

/**
* Building: Generator
Expand Down
4 changes: 2 additions & 2 deletions src/const/world/entities/buildings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BuildingAmmunition } from '~entity/building/variants/ammunition';
import { BuildingBooster } from '~entity/building/variants/booster';
import { BuildingElectro } from '~entity/building/variants/electro';
import { BuildingGenerator } from '~entity/building/variants/generator';
import { BuildingRadar } from '~entity/building/variants/radar';
import { BuildingTowerElectro } from '~entity/building/variants/tower/variants/electro';
import { BuildingTowerFire } from '~entity/building/variants/tower/variants/fire';
import { BuildingTowerFrozen } from '~entity/building/variants/tower/variants/frozen';
import { BuildingTowerLazer } from '~entity/building/variants/tower/variants/lazer';
Expand All @@ -14,7 +14,7 @@ export const BUILDINGS: Record<BuildingVariant, IBuildingFactory> = {
[BuildingVariant.TOWER_FROZEN]: BuildingTowerFrozen,
[BuildingVariant.TOWER_FIRE]: BuildingTowerFire,
[BuildingVariant.TOWER_LAZER]: BuildingTowerLazer,
[BuildingVariant.ELECTRO]: BuildingElectro,
[BuildingVariant.TOWER_ELECTRO]: BuildingTowerElectro,
[BuildingVariant.GENERATOR]: BuildingGenerator,
[BuildingVariant.AMMUNITION]: BuildingAmmunition,
[BuildingVariant.BOOSTER]: BuildingBooster,
Expand Down
9 changes: 7 additions & 2 deletions src/game/scenes/screen/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import VirtualJoystick from 'phaser3-rex-plugins/plugins/virtualjoystick';

import { INTERFACE_SCALE } from '~const/interface';
import { Scene } from '~game/scenes';
import { Analytics } from '~lib/analytics';
import { Assets } from '~lib/assets';
import { GameScene } from '~type/game';
import { LangPhrase } from '~type/lang';
Expand Down Expand Up @@ -34,11 +35,15 @@ export class Screen extends Scene implements IScreen {
}

public update() {
this.handleJoystick();
try {
this.handleJoystick();
} catch (error) {
Analytics.TrackWarn('Failed to update screen', error as TypeError);
}
}

public failure(text?: LangPhrase, format?: any[]) {
this.game.sound.play(ScreenAudio.ERROR);
this.sound.play(ScreenAudio.ERROR);
if (text) {
this.events.emit(ScreenEvents.NOTICE, { text, format });
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/scenes/world/__mocks__/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const world = {
on: jest.fn(),
off: jest.fn(),
},
sound: {
play: jest.fn(),
fx: {
playSound: jest.fn(),
},
};

Expand Down
8 changes: 4 additions & 4 deletions src/game/scenes/world/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Builder extends Phaser.Events.EventEmitter implements IBuilder {
this.close();
}
} catch (error) {
Analytics.TrackWarn('Failed builder update', error as TypeError);
Analytics.TrackWarn('Failed to update builder', error as TypeError);
}
}

Expand Down Expand Up @@ -127,15 +127,15 @@ export class Builder extends Phaser.Events.EventEmitter implements IBuilder {
this.variant = variant;
}

this.scene.sound.play(BuildingAudio.SELECT);
this.scene.fx.playSound(BuildingAudio.SELECT);
}

public unsetBuildingVariant() {
if (this.variant === null) {
return;
}

this.scene.sound.play(BuildingAudio.UNSELECT);
this.scene.fx.playSound(BuildingAudio.UNSELECT);

this.clearBuildingVariant();

Expand Down Expand Up @@ -336,7 +336,7 @@ export class Builder extends Phaser.Events.EventEmitter implements IBuilder {
this.scene.player.takeResources(BuildingInstance.Cost);
this.scene.player.giveExperience(DIFFICULTY.BUILDING_BUILD_EXPERIENCE);

this.scene.sound.play(BuildingAudio.BUILD);
this.scene.fx.playSound(BuildingAudio.BUILD);

if (this.variant) {
if (this.scene.game.isDesktop()) {
Expand Down
21 changes: 17 additions & 4 deletions src/game/scenes/world/effects/fx-manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Analytics } from '~lib/analytics';
import { Environment } from '~lib/environment';
import { GameFlag, GameSettings } from '~type/game';
import { IWorld } from '~type/world';
import { EffectTexture, IParticlesParent, ParticlesTexture } from '~type/world/effects';
import { IFXManager } from '~type/world/effects/fx-manager';
import { IFXManager, SoundParams } from '~type/world/effects/fx-manager';
import { IBuilding } from '~type/world/entities/building';
import { INPC } from '~type/world/entities/npc';
import { IEnemy } from '~type/world/entities/npc/enemy';
Expand All @@ -20,6 +21,18 @@ export class FXManager implements IFXManager {
this.scene = scene;
}

public playSound(key: string | string[], params: SoundParams = {}) {
try {
const sound = typeof key === 'string' ? key : Phaser.Utils.Array.GetRandom(key);

if (!params.limit || this.scene.sound.getAll(sound).length < params.limit) {
this.scene.sound.play(sound, params);
}
} catch (error) {
Analytics.TrackWarn('Failed to play sound', error as TypeError);
}
}

public createDustEffect(parent: IPlayer) {
if (!this.isEffectsEnabled()) {
return null;
Expand Down Expand Up @@ -306,7 +319,7 @@ export class FXManager implements IFXManager {
return new Particles(parent, {
key: 'generate',
texture: ParticlesTexture.BIT,
position: parent.getTopFace(),
position: parent.getTopEdgePosition(),
depth: parent.depth + 1,
params: {
duration: 300,
Expand Down Expand Up @@ -354,7 +367,7 @@ export class FXManager implements IFXManager {

return new Effect(this.scene, {
texture: EffectTexture.DAMAGE,
position: building.getTopFace(),
position: building.getTopEdgePosition(),
depth: building.depth + 1,
rate: 14,
});
Expand All @@ -367,7 +380,7 @@ export class FXManager implements IFXManager {

return new Effect(this.scene, {
texture: EffectTexture.SMOKE,
position: building.getBottomFace(),
position: building.getBottomEdgePosition(),
depth: building.depth + 1,
rate: 18,
});
Expand Down
7 changes: 6 additions & 1 deletion src/game/scenes/world/effects/particles.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Analytics } from '~lib/analytics';
import { Assets } from '~lib/assets';
import { IWorld } from '~type/world';
import {
Expand Down Expand Up @@ -70,6 +71,10 @@ export class Particles implements IParticles {
}

private update() {
this.emitter.setDepth(this.parent.depth + 1);
try {
this.emitter.setDepth(this.parent.depth + 1);
} catch (error) {
Analytics.TrackWarn('Failed to update particles', error as TypeError);
}
}
}
35 changes: 16 additions & 19 deletions src/game/scenes/world/entities/building/building.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi

this.scene.player.giveExperience(experience);

this.scene.game.sound.play(BuildingAudio.UPGRADE);
this.scene.fx.playSound(BuildingAudio.UPGRADE);

if (Tutorial.IsInProgress(TutorialStep.UPGRADE_BUILDING)) {
Tutorial.Complete(TutorialStep.UPGRADE_BUILDING);
Expand Down Expand Up @@ -382,7 +382,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi

this.scene.player.takeResources(cost);

this.scene.sound.play(BuildingAudio.REPAIR);
this.scene.fx.playSound(BuildingAudio.REPAIR);
}

private upgradeHealth() {
Expand Down Expand Up @@ -416,7 +416,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
}

private updateIndicatorsPosition() {
const position = this.getTopFace();
const position = this.getTopEdgePosition();

this.indicators.setPosition(
position.x - (BUILDING_TILE.width / 4),
Expand Down Expand Up @@ -473,7 +473,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
hintId = this.scene.showHint({
side: 'top',
label,
position: this.getBottomFace(),
position: this.getBottomEdgePosition(),
unique: true,
});
}
Expand All @@ -490,16 +490,13 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
private onDamage() {
this.updateTileCost();

const audio = Phaser.Utils.Array.GetRandom([
this.scene.fx.createDamageEffect(this);
this.scene.fx.playSound([
BuildingAudio.DAMAGE_1,
BuildingAudio.DAMAGE_2,
]);

if (this.scene.game.sound.getAll(audio).length === 0) {
this.scene.game.sound.play(audio);
}

this.scene.fx.createDamageEffect(this);
], {
limit: 1,
});

if (
this.scene.isModeActive(WorldMode.AUTO_REPAIR)
Expand Down Expand Up @@ -530,14 +527,14 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
this.isFocused = false;
}

public getTopFace() {
public getTopEdgePosition() {
return {
x: this.x,
y: this.y - BUILDING_TILE.height * 0.5,
};
}

public getBottomFace() {
public getBottomEdgePosition() {
return {
x: this.x,
y: this.y,
Expand All @@ -549,7 +546,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
return;
}

const position = this.getTopFace();
const position = this.getTopEdgePosition();

this.alertIcon = this.scene.add.image(position.x, position.y, BuildingIcon.ALERT);
this.alertIcon.setDepth(this.depth + 1);
Expand Down Expand Up @@ -581,7 +578,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
this.removeUpgradeIcon();
}

const position = this.getTopFace();
const position = this.getTopEdgePosition();

this.upgradeIcon = this.scene.add.image(position.x, position.y, BuildingIcon.UPGRADE);
this.upgradeIcon.setDepth(this.depth + 1);
Expand Down Expand Up @@ -694,7 +691,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
return;
}

const position = this.getBottomFace();
const position = this.getBottomEdgePosition();

this.actionsArea = this.scene.add.ellipse(position.x, position.y);
this.actionsArea.setFillStyle(0xffffff, 0.3);
Expand Down Expand Up @@ -731,7 +728,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
}

public break() {
this.scene.sound.play(BuildingAudio.DEAD);
this.scene.fx.playSound(BuildingAudio.DEAD);
this.scene.fx.createSmokeEffect(this);

const group = this.scene.getEntitiesGroup(EntityType.BUILDING);
Expand Down Expand Up @@ -805,7 +802,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
color: 0xffffff,
});

const position = this.getTopFace();
const position = this.getTopEdgePosition();

this.buildBar.setPosition(
position.x - this.buildBar.width / 2,
Expand Down
Loading

0 comments on commit 90209da

Please sign in to comment.