Skip to content

Commit

Permalink
llaristic patched
Browse files Browse the repository at this point in the history
  • Loading branch information
PacharaphonP committed May 21, 2023
1 parent a1269e6 commit 6bd3f36
Show file tree
Hide file tree
Showing 89 changed files with 583 additions and 528 deletions.
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 bin/Chicknight/ChicknightRightWalk2.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 bin/Elysia.jpeg
Binary file not shown.
Binary file added bin/EyeOfQwifot/EyeOfQwifotAtk.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 modified bin/MainMenu/MenuButton.class
Binary file not shown.
Binary file modified bin/Object/Projectile.class
Binary file not shown.
Binary file added bin/Tiles/GrayTile.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 bin/Tiles/WhiteTile.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 bin/Tiles/blackStarTile.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 bin/Tiles/blackTile.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 renamed bin/test1.png → bin/Tiles/pathTile.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 bin/Util/Vector.class
Binary file not shown.
Binary file modified bin/application/Main$1.class
Binary file not shown.
Binary file modified bin/application/Main.class
Binary file not shown.
Binary file added bin/constant/Constant$ScreenSize.class
Binary file not shown.
Binary file added bin/constant/Constant.class
Binary file not shown.
Binary file added bin/constant/Direction.class
Binary file not shown.
Binary file added bin/constant/EntityState.class
Binary file not shown.
Binary file added bin/constant/GameState.class
Binary file not shown.
Binary file modified bin/drawing/GameScreen.class
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified bin/logic/.DS_Store
Binary file not shown.
Binary file modified bin/logic/entity/Chicknight.class
Binary file not shown.
Binary file modified bin/logic/entity/Enemy.class
Binary file not shown.
Binary file modified bin/logic/entity/Entity.class
Binary file not shown.
Binary file modified bin/logic/entity/EyeOfQwifot.class
Binary file not shown.
Binary file modified bin/logic/entity/GriszlyEye.class
Binary file not shown.
Binary file modified bin/logic/entity/LlaristicKnight.class
Binary file not shown.
Binary file modified bin/logic/entity/MagicalTortoise.class
Binary file not shown.
Binary file modified bin/logic/entity/Mole.class
Binary file not shown.
Binary file modified bin/logic/entity/MoleDerKaiser.class
Binary file not shown.
Binary file modified bin/logic/entity/Player.class
Binary file not shown.
Binary file modified bin/logic/entity/ShadowPot.class
Binary file not shown.
Binary file modified bin/logic/field/Map1.class
Binary file not shown.
Binary file modified bin/logic/game/GameLogic.class
Binary file not shown.
Binary file removed bin/moon.png
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file removed bin/player/Rabbi.png
Binary file not shown.
Binary file removed bin/player/RabbiLeft.png
Binary file not shown.
Binary file removed bin/player/RabbiRightAtk.png
Binary file not shown.
Binary file added bin/player/slashLeft.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 bin/player/slashRight.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 modified bin/sharedObject/RenderableHolder.class
Binary file not shown.
Binary file added bin/sound/llaristicTheme.wav
Binary file not shown.
Binary file added res/Chicknight/ChicknightLeftWalk2.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/Chicknight/ChicknightRightWalk2.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/Elysia.jpeg
Binary file not shown.
Binary file added res/EyeOfQwifot/EyeOfQwifotAtk.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/Tiles/GrayTile.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/Tiles/WhiteTile.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/Tiles/blackStarTile.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/Tiles/blackTile.png
Binary file renamed res/test1.png → res/Tiles/pathTile.png
Binary file removed res/moon.png
Diff not rendered.
File renamed without changes
File renamed without changes
Binary file removed res/player/Rabbi.png
Diff not rendered.
Binary file removed res/player/RabbiLeft.png
Diff not rendered.
Binary file removed res/player/RabbiRightAtk.png
Diff not rendered.
Binary file added res/player/slashLeft.png
Binary file added res/player/slashRight.png
Binary file added res/sound/llaristicTheme.wav
Binary file not shown.
Binary file removed res/test2.png
Diff not rendered.
1 change: 0 additions & 1 deletion src/MainMenu/MenuButton.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package MainMenu;

import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.effect.*;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
Expand Down
1 change: 0 additions & 1 deletion src/Object/Projectile.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import logic.entity.Player;
import logic.game.GameLogic;
import sharedObject.IRenderable;
import sharedObject.RenderableHolder;

public abstract class Projectile implements IRenderable {
protected Image image;
Expand Down
28 changes: 28 additions & 0 deletions src/Util/Vector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package Util;

public class Vector <T>{
private T x,y;

public Vector(T x , T y) {
this.x = x;
this.y = y;
}

public T getX() {
return x;
}

public T getY() {
return y;
}

public void setX(T x) {
this.x = x;
}

public void setY(T y) {
this.y = y;
}


}
51 changes: 19 additions & 32 deletions src/application/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package application;

import MainMenu.GameMenu;
import constant.Constant;
import drawing.GameScreen;
import input.InputUtility;
import javafx.animation.AnimationTimer;
Expand All @@ -9,26 +10,18 @@
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;
import logic.game.GameLogic;
import logic.entity.Player;
import sharedObject.RenderableHolder;

public class Main extends Application {

Scene gameScene, mainScene;

public static void main(String[] args) {
// TODO Auto-generated method stub
Application.launch(args);
}

public static int second;
public static long lastTimeTriggered = -1;

private static long lastTimeTriggered = -1;
public static boolean isStart = false;
private static GameMenu gameMenu;
public static Stage stage;
Expand All @@ -38,33 +31,26 @@ public static void main(String[] args) {
private static GameLogic logic;
private static AnimationTimer animation;

final static int width = 1280;
final static int height = 720;

public Stage getStage() {
return stage;
}

public boolean isStart() {
return isStart;
}


public static void GameStart() {

System.out.println(isStart);
root.getChildren().removeAll(bg, gameMenu);
gameScreen = new GameScreen(width, height);
gameScreen = new GameScreen(Constant.ScreenSize.GAMEWIDTH, Constant.ScreenSize.GAMEHEIGHT);
logic = new GameLogic(gameScreen);
root.getChildren().add(gameScreen);
gameScreen.requestFocus();
//
//
second = 0 ;
second = 0;
animation = new AnimationTimer() {
long previousTime = 0;
double drawInterval = 1e9 / 60;
double delta = 0;

public void handle(long now) {
// timer
lastTimeTriggered = (lastTimeTriggered < 0 ? now : lastTimeTriggered);
Expand Down Expand Up @@ -100,39 +86,40 @@ public void start(Stage stage) {

Main.stage = stage;
Main.root = new StackPane();
root.setPrefSize(width, height);
root.setPrefSize(Constant.ScreenSize.GAMEWIDTH, Constant.ScreenSize.GAMEHEIGHT);

gameMenu = new GameMenu();

Image img = new Image(ClassLoader.getSystemResource("darkSoul4.png").toString());
Image img = new Image(ClassLoader.getSystemResource("other/darkSoul4.png").toString());
bg = new ImageView(img);
bg.setFitWidth(width);
bg.setFitHeight(height);
bg.setFitWidth(Constant.ScreenSize.GAMEWIDTH);
bg.setFitHeight(Constant.ScreenSize.GAMEHEIGHT);

root.getChildren().addAll(bg, gameMenu);
gameMenu.setVisible(false);

Scene scene = new Scene(root);
if (!gameMenu.isVisible()) {
scene.setOnKeyPressed(e -> {
System.out.println("attempt");
scene.setOnKeyPressed(e -> {
// System.out.println("attempt");

FadeTransition ft = new FadeTransition(Duration.seconds(1), gameMenu);
ft.setFromValue(0);
ft.setToValue(1);
gameMenu.setVisible(true);
ft.play();
});

});
}

stage.setTitle("Black Light Matter");
stage.setScene(scene);
stage.show();
}

public static void main(String[] args) {
// TODO Auto-generated method stub

//
//
Application.launch(args);
}

}
9 changes: 9 additions & 0 deletions src/constant/Constant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package constant;

public class Constant {
public static class ScreenSize {
public final static int GAMEWIDTH = 1280;
public final static int GAMEHEIGHT = 720;
}

}
5 changes: 5 additions & 0 deletions src/constant/Direction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package constant;

public enum Direction {
UP,DOWN,LEFT,RIGHT
}
5 changes: 5 additions & 0 deletions src/constant/EntityState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package constant;

public enum EntityState {
DEFAULT,ALIVE,DEAD,ATTACK,MOVING
}
5 changes: 5 additions & 0 deletions src/constant/GameState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package constant;

public enum GameState {
PLAYSTATE,PAUSESTATE,NPCSTATE,GAMEOVERSTATE,WINSTATE
}
8 changes: 1 addition & 7 deletions src/drawing/GameScreen.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
package drawing;

import MainMenu.GameOverButton;
import input.InputUtility;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import logic.game.GameLogic;
import sharedObject.IRenderable;
import sharedObject.RenderableHolder;

public class GameScreen extends Canvas {
private boolean paused = false;


public GameScreen(double width, double height) {
super(width, height);
Expand Down
Binary file modified src/logic/.DS_Store
Binary file not shown.
67 changes: 32 additions & 35 deletions src/logic/entity/Chicknight.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package logic.entity;

import constant.Direction;
import constant.EntityState;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import logic.game.GameLogic;
import sharedObject.RenderableHolder;

public class Chicknight extends Enemy {


public Chicknight(double x, double y, GameLogic gameLogic) {
super(x,y,gameLogic);
super(x, y, gameLogic);
this.maxHp = 30;
this.currentHealth = maxHp;
this.dmg = 5;
Expand All @@ -25,29 +25,28 @@ public void draw(GraphicsContext gc) {
// TODO Auto-generated method stub
// System.out.println(c);
switch (direction) {
case "right":
case RIGHT:
if (attackState)
image = RenderableHolder.cKRightAtk;
else {
image = RenderableHolder.cKRight;
if (currentState == "attacking") {
if (currentState == EntityState.ATTACK) {
if (gameLogic.getCounter() / 10 % 2 == 1)
image = RenderableHolder.cKRightWalk1;
}
}
break;
case "left":
case LEFT:
if (attackState)
image = RenderableHolder.cKLeftAtk;
else {
image = RenderableHolder.cKLeft;
if (currentState == "attacking") {
if (currentState == EntityState.ATTACK) {
if (gameLogic.getCounter() / 10 % 2 == 1)
image = RenderableHolder.cKLeftWalk1;
}
}
break;

}

gc.drawImage(image, screenX, screenY);
Expand All @@ -56,37 +55,35 @@ public void draw(GraphicsContext gc) {
// drawAttackBlock(gc);
}



@Override
public void update() {
// TODO Auto-generated method stub
super.update();
if (playerfound(500))
currentState = "attacking";
if (playerfound(500))
currentState = EntityState.ATTACK;
else
currentState = "default";
currentState = EntityState.DEFAULT;
Player player = gameLogic.getPlayer();
canAttack = canAttack(player.solidScreen.getX()+solidScreen.getWidth()/2, player.solidScreen.getY()+solidScreen.getHeight()/2, solidScreen.getX()+solidScreen.getWidth()/2, solidScreen.getY()+solidScreen.getHeight()/2,
canAttack = canAttack(player.solidScreen.getX() + solidScreen.getWidth() / 2,
player.solidScreen.getY() + solidScreen.getHeight() / 2,
solidScreen.getX() + solidScreen.getWidth() / 2, solidScreen.getY() + solidScreen.getHeight() / 2,
(int) (32));
if (currentState == "attacking") {
if(canAttack) {
if(delay==0) {
attackState = true;
attack(gameLogic.getPlayer());
RenderableHolder.chicknightSound.play(0.2);
delay = 60;
if (currentState == EntityState.ATTACK) {
if (canAttack) {
if (delay == 0) {
attackState = true;
attack(gameLogic.getPlayer());
RenderableHolder.chicknightSound.play(0.2);
delay = 60;
}
}
else {
} else {
xspeed = Math.cos(angle) * speed;
yspeed = Math.sin(angle) * speed;


if (yspeed < 0)
direction = "up";
direction = Direction.UP;
else
direction = "down";
direction = Direction.DOWN;
setCollisionOn(false);
gameLogic.checkTile(this);
if (collisionOn == false) {
Expand All @@ -95,18 +92,20 @@ public void update() {
}

if (xspeed < 0)
direction = "left";
direction = Direction.LEFT;
else
direction = "right";
direction = Direction.RIGHT;

setCollisionOn(false);
gameLogic.checkTile(this);
if (collisionOn == false) {
worldX += xspeed;
}
}
if(delay==40) attackState = false;
if (delay>0) delay--;
if (delay == 40)
attackState = false;
if (delay > 0)
delay--;

}
updateAttackBlock();
Expand All @@ -117,15 +116,13 @@ public void initSolidArea() {
}

public void initAttackBlock() {
attackBlock = new Rectangle(screenX+solidArea.getWidth(), screenY, solidArea.getWidth()+10 * 2, 64);
attackBlock = new Rectangle(screenX + solidArea.getWidth(), screenY, solidArea.getWidth() + 10 * 2, 64);
}

// Debug Chick
public void drawAttackBlock(GraphicsContext gc) {
gc.setFill(Color.BLACK);
gc.strokeRect(attackBlock.getX(), attackBlock.getY(), attackBlock.getWidth(),
attackBlock.getHeight());
gc.strokeRect(attackBlock.getX(), attackBlock.getY(), attackBlock.getWidth(), attackBlock.getHeight());
}


}
Loading

0 comments on commit 6bd3f36

Please sign in to comment.