Update game to use the correct Java version and directory

Updated the project configuration to use Java 21 and run the game from the correct directory, resolving previous Java version conflicts and ensuring proper execution.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: f6819c21-e85d-45ac-acde-604db2cfa4fe
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: ed832e25-fc86-4753-8cfc-80cfabc64a02
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
CoolGuy27
2026-04-20 18:57:28 +00:00
parent d27949385e
commit 3658610a9f
86 changed files with 1279 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
import java.util.*;
import javax.swing.ImageIcon;
public class Player extends Collidable {
static final int JUMP_HEIGHT = 10;
static final int POWER_DURATION = 2000; // 2000 ticks ≈ 30 seconds
static final int I_FRAMES = 67; // ~1 second
static final int SHOOT_COOLDOWN = 33; // ~0.5 second
int health;
int yVelo;
int xVelo;
boolean onGround;
int curPower;
int powerTimer;
int airJumps;
int facing; // 1 is right -1 is left
int invincibleTimer;
int shootCooldown;
int numAmendments;
public Player(int x, int y, int w, int h) {
super(x, y, w, h, new ImageIcon("Sprites/Player/1.png"));
xVelo = 0;
yVelo = 0;
onGround = false;
curPower = 0;
powerTimer = 0;
airJumps = 0;
invincibleTimer = 0;
shootCooldown = 0;
health = 3;
facing = 1;
numAmendments = 0;
}
public void moveX(int moveX) {
this.x += moveX;
this.rect.x = this.x;
}
public void moveY(int moveY) {
this.y += moveY;
this.rect.y = this.y;
}
public void setLevel(int level) {
if (level >= 2) {
this.icon = new ImageIcon("Sprites/Player/2.png");
return;
}
this.icon = new ImageIcon("Sprites/Player/" + level + ".png");
}
public void onCollideX(Collidable other) {
if (other instanceof Tile) {
Tile t = (Tile) other;
int playerCenterX = this.x + this.width / 2;
int tileCenterX = t.x + t.width / 2;
if (playerCenterX > tileCenterX) { // player on right side of tiile
this.x = t.x + t.width;
} else { // player on left side of tile
this.x = t.x - this.width;
}
this.xVelo = 0;
this.rect.x = this.x;
}
}
public void onCollideY(Collidable other, ArrayList<Collectable> collectables) {
if (other instanceof Tile) {
Tile t = (Tile) other;
if (this.yVelo >= 0) { // falling down, land on top of tile
this.y = t.y - this.height;
onGround = true;
airJumps = 0;
} else { // moving up, hit underside of tile
this.y = t.y + t.height;
if (other instanceof PowerBrick) {
PowerBrick pb = (PowerBrick) other;
if (!pb.hit) {
pb.spawnPower(collectables);
}
}
}
this.yVelo = 0;
this.rect.y = this.y;
}
}
public void takeDamage() {
if (invincibleTimer <= 0) {
health--;
invincibleTimer = I_FRAMES;
}
}
public void reset() {
this.rect.x = this.x;
this.rect.y = this.y;
this.xVelo = this.yVelo = 0;
this.curPower = 0;
this.powerTimer = 0;
this.airJumps = 0;
this.onGround = false;
this.invincibleTimer = 0;
this.shootCooldown = 0;
this.facing = 1;
this.numAmendments = 0;
}
}