Skip to content

Commit

Permalink
Merge branch 'main' into sistemaUsuario
Browse files Browse the repository at this point in the history
  • Loading branch information
delfi-fenoy authored Nov 14, 2024
2 parents 348fcca + 72b9b37 commit 96a3393
Show file tree
Hide file tree
Showing 23 changed files with 492 additions and 69 deletions.
9 changes: 9 additions & 0 deletions .idea/libraries/json_20240304.xml

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

1 change: 1 addition & 0 deletions Legion 501.iml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="json-20240303" level="project" />
<orderEntry type="library" name="json-20240304" level="project" />
</component>
</module>
Binary file added res/501_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/admin_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/button_atlas.png
Binary file not shown.
Binary file added res/login_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/menu_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added res/pause_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/pause_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/register_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/resume_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions src/entities/BulletManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import java.awt.*;
import java.util.ArrayList;

import static utilz.Constants.EnemyConstants.DEAD;
import static utilz.Constants.EnemyConstants.HIT;
import static utilz.Constants.PlayerConstants.EXPLODE;
import static utilz.HelpMethods.DetectCollision;

public class BulletManager implements IRenderable {
Expand All @@ -18,6 +15,7 @@ public class BulletManager implements IRenderable {
public ArrayList<Bullet> bulletPlayerArr = new ArrayList<>(); // Arraylist con las balas
public ArrayList<Bullet> bulletAlienArr = new ArrayList<>(); // Arraylist con las balas
private float bulletSpeed = 5.0f; // Velocidad de la bala
private boolean updatingBullets = false;

// ====================> CONSTRUCTOR <====================
public BulletManager(Playing playing) {
Expand Down Expand Up @@ -79,6 +77,13 @@ public void createBullet() {
bulletPlayerArr.add(bullet);
}

public void clearBullets() {
updatingBullets = true; // Activar flag de pausa
bulletPlayerArr.clear();
bulletAlienArr.clear();
updatingBullets = false; // Desactivar flag al terminar
}

/** createBulletAlien() ==> Crea una bala en el Enemigo */
public <T extends Enemy> void createBulletAlien(T alien) {
Bullet bullet = new Bullet(
Expand All @@ -92,7 +97,9 @@ public <T extends Enemy> void createBulletAlien(T alien) {

/** Interface IRenderable */
public void update(){
move();
if (!updatingBullets) {
move();
}
}

public void draw(Graphics g){
Expand Down
5 changes: 4 additions & 1 deletion src/entities/EnemyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public void setAlienVelocityX(float alienVelocityX) {
this.alienVelocityX = alienVelocityX;
}

public int getRemainingAliens() {
return getEnemies().size();
}

// ====================> METODOS <====================
/** move() ==> Se encarga de mover la ubicacion de los aliens1. */
public void move(){
Expand Down Expand Up @@ -150,7 +154,6 @@ public void createAliens() {
}
}
}
playing.alienCount = enemies.size(); // Actualizamos el contador total de aliens
}

/** spawnAlien() ==> Crea una instancia de un alien específico según el tipo dado. */
Expand Down
24 changes: 13 additions & 11 deletions src/gameState/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import exceptions.NonexistentUserException;
import main.Game;
import main.GamePanel;
import static utilz.LoadSave.*;
import utilz.LoadSave;
import users.User;

import javax.swing.*;
Expand Down Expand Up @@ -45,8 +47,8 @@ public void initUI(){
quitButton = new JButton("Quit");
userIDField = new JTextField();
userPasswordField = new JPasswordField();
userIDLabel = new JLabel("User name:");
userPasswordLabel = new JLabel("Password:");
userIDLabel = new JLabel("");
userPasswordLabel = new JLabel("");

backButton.setText("Register");

Expand Down Expand Up @@ -131,14 +133,9 @@ public void update() {

@Override
public void draw(Graphics g) {
// Titulo
g.setFont(new Font("Console", Font.BOLD, 70));
g.setColor(Color.WHITE);
g.drawString("Legion 501", 50, 150);
g.setFont(new Font("Console", Font.BOLD, 40));
g.setColor(Color.GRAY);
g.drawString("Login", 170, 230);

// Fondo y Titulo
LoadSave.drawTitleBackgroud(g,LOGIN_BACKGROUD);

if(showMessage || showMessage2){
g.setFont(new Font("Console", Font.BOLD, 12));
g.setColor(Color.RED);
Expand All @@ -149,7 +146,12 @@ public void draw(Graphics g) {
g.drawString("Nombre de usuario y/o contraseña incorrectos.", Game.GAME_WIDTH/2-100, 405);
}
}


// Textos
g.setColor(Color.WHITE);
g.setFont(new Font("Console", Font.BOLD, 25));
g.drawString("Username", 180, 340);
g.drawString("Password", 180, 440);
}
}

16 changes: 9 additions & 7 deletions src/gameState/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import main.Game;
import ui.MenuButton;
import utilz.LoadSave;

import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;

import static utilz.LoadSave.*;

/**
* Menu ==>
Expand All @@ -26,10 +30,10 @@ public Menu(Game game) {

// ====================> METODOS <====================
private void loadButtons() {
buttons[0] = new MenuButton(Game.GAME_WIDTH / 2, (int) (150*Game.SCALE),0,GameState.PLAYING); // Primero (y = 150)
buttons[0] = new MenuButton(Game.GAME_WIDTH / 2, (int) (170*Game.SCALE),0,GameState.PLAYING); // Primero (y = 150)
buttons[3] = new MenuButton(Game.GAME_WIDTH / 2, (int) (240*Game.SCALE),3,GameState.RANKING); // Segundo (y = 230)
buttons[1] = new MenuButton(Game.GAME_WIDTH / 2, (int) (310*Game.SCALE),1,GameState.OPTIONS); // Tercero (y = 310)
buttons[2] = new MenuButton(Game.GAME_WIDTH / 2, (int) (390*Game.SCALE),2,GameState.QUIT); // Cuarto (y = 390)
buttons[3] = new MenuButton(Game.GAME_WIDTH / 2, (int) (230*Game.SCALE),3,GameState.RANKING); // Segundo (y = 230)
buttons[2] = new MenuButton(Game.GAME_WIDTH / 2, (int) (380*Game.SCALE),2,GameState.LOGIN); // Cuarto (y = 390)
// La yPos, se debe editar manualmente y le agregamos al final a que state pertene el boton
}

Expand All @@ -49,10 +53,8 @@ public void update() {

@Override
public void draw(Graphics g) {
//"Titulo" medio feo
g.setColor(Color.WHITE);
g.setFont(new Font("Console", Font.BOLD, 60));
g.drawString("Legion 501", 70, 100);
// Fondo y Titulo
LoadSave.drawTitleBackgroud(g,MENU_BACKGROUD);

for(MenuButton mb : buttons) {
mb.draw(g);
Expand Down
Loading

0 comments on commit 96a3393

Please sign in to comment.