Skip to content

Commit

Permalink
Merge pull request #10 from SebSanUwU/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SebSanUwU authored May 16, 2024
2 parents 4589626 + 2f0d4ea commit 3d55a27
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ul {
padding-inline: 1rem 3.5rem;
}

.dropdown__subitem .dropdown__link {
.dropdown__subitem {
padding-inline: 1rem;
}

Expand Down
1 change: 1 addition & 0 deletions src/app/components/game/scenes/CavernaScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class CavernaScene extends DesertScene {
override init(data: any) {
this.socket.connect();
this.code = data.code;
this.socket.emit('joinRoom', this.code); // NO BORRAR BAJO NINGUNA CIRCUNSTANCIA SI QUIERE QUE EL JUEGO SIRVA :D
this.cantidadVida = data.cantidadVida;
this.heartsGroup = data.heartsGroup;
this.pointsInitial = data.score;
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/game/scenes/DesertScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ObjectCoollectible } from '../objects/objectCoollectible';
import { ScoreBoard } from '../objects/scoreBoard';
import { MainScene } from './MainScene';


enum Direction {
UP,
DOWN,
Expand Down Expand Up @@ -43,6 +42,7 @@ export class DesertScene extends MainScene {
override init(data: any) {
this.socket.connect();
this.code = data.code;
this.socket.emit('joinRoom', this.code); // NO BORRAR BAJO NINGUNA CIRCUNSTANCIA SI QUIERE QUE EL JUEGO SIRVA :D
this.socket.off('initialCoordinates');
this.socket.off('firstPlayer');
this.socket.off('playerNumber');
Expand Down Expand Up @@ -70,7 +70,6 @@ export class DesertScene extends MainScene {
this.prepareToTransition(data, 'CavernaScene');
});


}

override preload() {
Expand Down
16 changes: 9 additions & 7 deletions src/app/components/game/scenes/MainScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export class MainScene extends Phaser.Scene {

init(data: any) {
this.socket.on('connect', () => {

this.code = data.code;
if (this.socket.id) {
this.playerId = this.socket.id;
this.socket.on('initialCoordinates', ({ x, y }) => {
Expand Down Expand Up @@ -107,12 +109,13 @@ export class MainScene extends Phaser.Scene {
this.create_remote_players();
}

// @ts-ignore: La creacion del mapa es necesaria de esta manera ya que la variable que se reasigna debe coincidir con el nombre del programa 'tilet'
// SonarCloud no tomará en cuenta ninguna advertencia en el siguiente bloque
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected create_mapa(width : number, height: number, key: string, tileImage: any, tileSet: any, layerNames: any, variableName: any) {
protected create_mapa(width: number, height: number, key: string, tileImage: any, tileSet: any, layerNames: any, variableName: any) {
// SonarCloud ignore start
// @ts-ignore: La creación del mapa es necesaria de esta manera ya que la variable que se reasigna debe coincidir con el nombre del programa 'tilet'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let mapa = this.make.tilemap({ key: key });
variableName = mapa.addTilesetImage(tileImage, tileSet);
// SonarCloud ignore end

if (variableName !== null) {
layerNames.forEach((layerName: string | number) => {
Expand All @@ -126,8 +129,6 @@ export class MainScene extends Phaser.Scene {
}
this.mapa = mapa;
}
// eslint-enable @typescript-eslint/no-unused-vars


protected create_player(width: number, height: number, position_x: number, position_y: number, spray: string) {
const newPositionX = position_x + Object.keys(this.otherSprites).length * 30;
Expand Down Expand Up @@ -175,7 +176,7 @@ export class MainScene extends Phaser.Scene {
}

protected validAnimations(player: any, existingSprite: Phaser.Physics.Matter.Sprite) {
if (existingSprite && existingSprite.anims) {
if (existingSprite?.anims) {
if (player.animation) {
if(player.key === undefined || player.key === 'dead'){
existingSprite.setStatic(true)
Expand Down Expand Up @@ -292,6 +293,7 @@ export class MainScene extends Phaser.Scene {
this.isAttacking = this.keys.space.isDown;
if (this.player?.anims?.currentAnim) {
if (this.player?.anims?.currentAnim.key == 'stand_' + this.lastDirection) {
// Intentionally empty
}
}
this.movePlayer();
Expand Down
4 changes: 2 additions & 2 deletions src/app/schemas/UserJson.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { gameStats } from 'src/app/schemas/gameStats'
import { GameStats } from 'src/app/schemas/gameStats'
import { FriendRequest } from './FriendRequest';

export interface UserJson {
id : number;
nickname : string;
mail: string;
game_stats: gameStats,
game_stats: GameStats,
friends : [string],
rooms : [number],
friendRequest:FriendRequest
Expand Down
2 changes: 1 addition & 1 deletion src/app/schemas/gameStats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface gameStats{
export interface GameStats{
levels_complete: number,
total_score: number,
objects_found: number,
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/rooms/rooms.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, inject } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { RoomsService } from './rooms.service';

Expand Down

0 comments on commit 3d55a27

Please sign in to comment.