diff --git a/res/.DS_Store b/res/.DS_Store index 5a8648b..e996f80 100644 Binary files a/res/.DS_Store and b/res/.DS_Store differ diff --git a/res/MoleDerKaiser/moleDerKaiser.png b/res/MoleDerKaiser/moleDerKaiser.png index 5b3838e..ce088b9 100644 Binary files a/res/MoleDerKaiser/moleDerKaiser.png and b/res/MoleDerKaiser/moleDerKaiser.png differ diff --git a/res/MoleDerKaiser/moleDerKaiserDead.png b/res/MoleDerKaiser/moleDerKaiserDead.png new file mode 100644 index 0000000..a799191 Binary files /dev/null and b/res/MoleDerKaiser/moleDerKaiserDead.png differ diff --git a/res/MoleDerKaiser/normalMoleDead.png b/res/MoleDerKaiser/normalMoleDead.png new file mode 100644 index 0000000..56d399d Binary files /dev/null and b/res/MoleDerKaiser/normalMoleDead.png differ diff --git a/res/mapTile/Tomb.png b/res/mapTile/Tomb.png index 46c1534..345ae43 100644 Binary files a/res/mapTile/Tomb.png and b/res/mapTile/Tomb.png differ diff --git a/res/mapTile/ground1.png b/res/mapTile/ground1.png index 6887e8a..07d6b8f 100644 Binary files a/res/mapTile/ground1.png and b/res/mapTile/ground1.png differ diff --git a/res/mapTile/ground2.png b/res/mapTile/ground2.png index 209988d..8223106 100644 Binary files a/res/mapTile/ground2.png and b/res/mapTile/ground2.png differ diff --git a/res/mapTile/ground3.png b/res/mapTile/ground3.png index 9f6f55f..f729803 100644 Binary files a/res/mapTile/ground3.png and b/res/mapTile/ground3.png differ diff --git a/res/mapTile/waterBottom.png b/res/mapTile/waterBottom.png new file mode 100644 index 0000000..f991c11 Binary files /dev/null and b/res/mapTile/waterBottom.png differ diff --git a/res/mapTile/waterBottomLeft.png b/res/mapTile/waterBottomLeft.png new file mode 100644 index 0000000..30b4861 Binary files /dev/null and b/res/mapTile/waterBottomLeft.png differ diff --git a/res/mapTile/waterBottomRight.png b/res/mapTile/waterBottomRight.png new file mode 100644 index 0000000..fab8ff6 Binary files /dev/null and b/res/mapTile/waterBottomRight.png differ diff --git a/res/mapTile/waterEdge1.png b/res/mapTile/waterEdge1.png new file mode 100644 index 0000000..ec66d26 Binary files /dev/null and b/res/mapTile/waterEdge1.png differ diff --git a/res/mapTile/waterEdge2.png b/res/mapTile/waterEdge2.png new file mode 100644 index 0000000..dcb9ffa Binary files /dev/null and b/res/mapTile/waterEdge2.png differ diff --git a/res/mapTile/waterEdge3.png b/res/mapTile/waterEdge3.png new file mode 100644 index 0000000..12d9e30 Binary files /dev/null and b/res/mapTile/waterEdge3.png differ diff --git a/res/mapTile/waterEdge4.png b/res/mapTile/waterEdge4.png new file mode 100644 index 0000000..be74c21 Binary files /dev/null and b/res/mapTile/waterEdge4.png differ diff --git a/res/mapTile/waterLeft.png b/res/mapTile/waterLeft.png new file mode 100644 index 0000000..83f797d Binary files /dev/null and b/res/mapTile/waterLeft.png differ diff --git a/res/mapTile/waterRight.png b/res/mapTile/waterRight.png new file mode 100644 index 0000000..36bbe0a Binary files /dev/null and b/res/mapTile/waterRight.png differ diff --git a/res/mapTile/waterTop.png b/res/mapTile/waterTop.png new file mode 100644 index 0000000..cbb5e78 Binary files /dev/null and b/res/mapTile/waterTop.png differ diff --git a/res/mapTile/waterTopLeft.png b/res/mapTile/waterTopLeft.png new file mode 100644 index 0000000..9da916b Binary files /dev/null and b/res/mapTile/waterTopLeft.png differ diff --git a/res/mapTile/waterTopRight.png b/res/mapTile/waterTopRight.png new file mode 100644 index 0000000..54756df Binary files /dev/null and b/res/mapTile/waterTopRight.png differ diff --git a/res/IngameSong.wav b/res/other/IngameSong.wav similarity index 100% rename from res/IngameSong.wav rename to res/other/IngameSong.wav diff --git a/res/other/Sword1.mp3 b/res/other/Sword1.mp3 new file mode 100644 index 0000000..c6c6346 Binary files /dev/null and b/res/other/Sword1.mp3 differ diff --git a/res/other/health_power_bar.png b/res/other/health_power_bar.png new file mode 100644 index 0000000..8b8e9ed Binary files /dev/null and b/res/other/health_power_bar.png differ diff --git a/res/other/shoot1.mp3 b/res/other/shoot1.mp3 new file mode 100644 index 0000000..f82bf55 Binary files /dev/null and b/res/other/shoot1.mp3 differ diff --git a/res/player/playerLeft.png b/res/player/playerLeft.png new file mode 100644 index 0000000..a55ec7d Binary files /dev/null and b/res/player/playerLeft.png differ diff --git a/res/player/playerLeftAtk.png b/res/player/playerLeftAtk.png new file mode 100644 index 0000000..d487d54 Binary files /dev/null and b/res/player/playerLeftAtk.png differ diff --git a/res/player/playerLeftWalk.png b/res/player/playerLeftWalk.png new file mode 100644 index 0000000..997e7a0 Binary files /dev/null and b/res/player/playerLeftWalk.png differ diff --git a/res/player/playerRight.png b/res/player/playerRight.png new file mode 100644 index 0000000..cc5e070 Binary files /dev/null and b/res/player/playerRight.png differ diff --git a/res/player/playerRightAtk.png b/res/player/playerRightAtk.png new file mode 100644 index 0000000..cc025fa Binary files /dev/null and b/res/player/playerRightAtk.png differ diff --git a/res/player/playerRightWalk.png b/res/player/playerRightWalk.png new file mode 100644 index 0000000..c18f9c1 Binary files /dev/null and b/res/player/playerRightWalk.png differ diff --git a/res/sound/GriszlyEyeSound.wav b/res/sound/GriszlyEyeSound.wav new file mode 100644 index 0000000..63e2245 Binary files /dev/null and b/res/sound/GriszlyEyeSound.wav differ diff --git a/res/sound/IngameSong.wav b/res/sound/IngameSong.wav new file mode 100644 index 0000000..0665c9a Binary files /dev/null and b/res/sound/IngameSong.wav differ diff --git a/res/sound/chicknight.mp3 b/res/sound/chicknight.mp3 new file mode 100644 index 0000000..c6c6346 Binary files /dev/null and b/res/sound/chicknight.mp3 differ diff --git a/res/sound/monsterdie.wav b/res/sound/monsterdie.wav new file mode 100644 index 0000000..ea3d748 Binary files /dev/null and b/res/sound/monsterdie.wav differ diff --git a/res/sound/npcSound.wav b/res/sound/npcSound.wav new file mode 100644 index 0000000..f4171ac Binary files /dev/null and b/res/sound/npcSound.wav differ diff --git a/res/sound/shootSound.mp3 b/res/sound/shootSound.mp3 new file mode 100644 index 0000000..1f90fdd Binary files /dev/null and b/res/sound/shootSound.mp3 differ diff --git a/res/sound/skill1.wav b/res/sound/skill1.wav new file mode 100644 index 0000000..68593f6 Binary files /dev/null and b/res/sound/skill1.wav differ diff --git a/res/sound/swing.mp3 b/res/sound/swing.mp3 new file mode 100644 index 0000000..ed475e1 Binary files /dev/null and b/res/sound/swing.mp3 differ diff --git a/src/.DS_Store b/src/.DS_Store index 0f0151f..47dc1ff 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/Object/Ball.java b/src/Object/Ball.java new file mode 100644 index 0000000..20945bb --- /dev/null +++ b/src/Object/Ball.java @@ -0,0 +1,28 @@ +package Object; + +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.shape.Rectangle; +import logic.game.GameLogic; +import sharedObject.RenderableHolder; + +public class Ball extends Projectile{ + + public Ball(double worldX, double worldY, double angle, GameLogic gameLogic) { + super(worldX, worldY, angle, gameLogic); + speed = 3; + xspeed = Math.cos(angle) * speed; + yspeed = Math.sin(angle) * speed; + dmg = 10; + solidArea = new Rectangle(0, 0, 8, 8); + solidScreen = new Rectangle(screenX+solidArea.getX(),screenY+solidArea.getY(),solidArea.getWidth(),solidArea.getHeight()); + RenderableHolder.shootSound.play(0.1); + } + + @Override + public void draw(GraphicsContext gc) { + // TODO Auto-generated method stub + gc.drawImage(RenderableHolder.ball, screenX, screenY); + drawHitbox(gc); + } + +} \ No newline at end of file diff --git a/src/Object/Projectile.java b/src/Object/Projectile.java index e9e096c..9550f17 100644 --- a/src/Object/Projectile.java +++ b/src/Object/Projectile.java @@ -8,32 +8,26 @@ import sharedObject.IRenderable; import sharedObject.RenderableHolder; -public class Projectile implements IRenderable { +public abstract class Projectile implements IRenderable { protected double worldX, worldY; public double screenX, screenY; - private Rectangle solidArea,solidScreen; - private double angle; - private int dmg, speed; + protected Rectangle solidArea,solidScreen; + protected double angle; + protected int dmg, speed; protected int z, radius; protected boolean visible, destroyed; public GameLogic gameLogic; - private double xspeed, yspeed; + protected double xspeed, yspeed; public Projectile(double worldX, double worldY, double angle, GameLogic gameLogic) { this.worldX = worldX; this.worldY = worldY; this.gameLogic = gameLogic; this.angle = angle; - this.speed = 3; this.z = 10; this.visible = true; this.destroyed = false; - this.xspeed = Math.cos(angle) * speed; - this.yspeed = Math.sin(angle) * speed; - this.dmg = 10; - solidArea = new Rectangle(0, 0, 8, 8); - solidScreen = new Rectangle(screenX,screenY,8,8); } public void update() { @@ -41,13 +35,11 @@ public void update() { worldY += yspeed; screenX = worldX - gameLogic.getPlayer().getWorldX() + gameLogic.getPlayer().screenX; screenY = worldY - gameLogic.getPlayer().getWorldY() + gameLogic.getPlayer().screenY; - solidArea.setX(screenX); - solidArea.setY(screenY); -// System.out.println("X =" + xspeed + " Y = " + yspeed); boolean isOut = screenX < 0 || screenX > 1280 || screenY < 0 || screenY > 720; if (isOut) { destroyed = true; } + solidScreen = new Rectangle(screenX+solidArea.getX(),screenY+solidArea.getY(),solidArea.getWidth(),solidArea.getHeight()); checkEnemyHit(); } @@ -57,15 +49,10 @@ public void checkEnemyHit() { int y = (int) p.getScreenY(); int width = (int) p.getSolidArea().getWidth(); int height = (int) p.getSolidArea().getHeight(); - boolean overlap = solidArea.intersects(x,y,width,height); - System.out.println("Overlap = " + overlap); - System.out.println("X = " + x + " Y = " + y); - if (overlap) { + if (solidScreen.intersects(x,y,width,height)) { p.changeHealthTo(p.getCurrentHealth() - dmg); destroyed = true; } - solidArea.setX(screenX); - solidArea.setY(screenY); } public Rectangle getSolidArea() { @@ -78,13 +65,7 @@ public int getZ() { return 0; } - @Override - public void draw(GraphicsContext gc) { - // TODO Auto-generated method stub - gc.drawImage(RenderableHolder.ball, screenX, screenY); - drawHitbox(gc); - } - + public abstract void draw(GraphicsContext gc); @Override public boolean isDestroyed() { // TODO Auto-generated method stub @@ -102,7 +83,7 @@ public boolean isVisible() { public void drawHitbox(GraphicsContext gc) { gc.setLineWidth(2); gc.setFill(Color.RED); - gc.strokeRect(solidArea.getX(), solidArea.getY(), solidArea.getWidth(), - solidArea.getHeight()); + gc.strokeRect(solidScreen.getX(), solidScreen.getY(), solidScreen.getWidth(), + solidScreen.getHeight()); } -} +} \ No newline at end of file diff --git a/src/Object/SwordBeam.java b/src/Object/SwordBeam.java new file mode 100644 index 0000000..1172ab4 --- /dev/null +++ b/src/Object/SwordBeam.java @@ -0,0 +1,30 @@ +package Object; + +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.shape.Rectangle; +import logic.game.GameLogic; +import sharedObject.RenderableHolder; + +public class SwordBeam extends Projectile{ + + public SwordBeam(double worldX, double worldY, double angle, GameLogic gameLogic) { + super(worldX, worldY, angle, gameLogic); + speed = 5; + xspeed = Math.cos(angle) * speed; + yspeed = Math.sin(angle) * speed; + dmg = 20; + if(Math.abs(xspeed)>Math.abs(yspeed)) + solidArea = new Rectangle(0, -16, 16, 128); + else + solidArea = new Rectangle(-16,0,128,16); + solidScreen = new Rectangle(screenX+solidArea.getX(),screenY+solidArea.getY(),solidArea.getWidth(),solidArea.getHeight()); + RenderableHolder.shootSound.play(0.1); + } + + @Override + public void draw(GraphicsContext gc) { + // TODO Auto-generated method stub + drawHitbox(gc); + } + +} \ No newline at end of file diff --git a/src/logic/entity/Chicknight.java b/src/logic/entity/Chicknight.java index a8b224e..edbf82e 100644 --- a/src/logic/entity/Chicknight.java +++ b/src/logic/entity/Chicknight.java @@ -26,36 +26,28 @@ public void draw(GraphicsContext gc) { // System.out.println(c); switch (direction) { case "right": - if (currentState == "attacking") - if (gameLogic.getCounter() / 10 % 2 == 1) { - image = RenderableHolder.CKRight; - } else { - if(canAttack) - image = RenderableHolder.CKRightAtk; - else - image =RenderableHolder.CKRightWalk1; - } - + if (attackState) + image = RenderableHolder.CKRightAtk; else { - image = RenderableHolder.CKRight; + image = RenderableHolder.CKRight; + if (currentState == "attacking") { + if (gameLogic.getCounter() / 10 % 2 == 1) + image = RenderableHolder.CKRightWalk1; + } } break; case "left": - if (currentState == "attacking") - if (gameLogic.getCounter() / 10 % 2 == 1) { - image = RenderableHolder.CKLeft; - } else { - if(canAttack) - image = RenderableHolder.CKLeftAtk; - else - image =RenderableHolder.CKLeftWalk1; - } - + if (attackState) + image = RenderableHolder.CKLeftAtk; else { - image = RenderableHolder.CKLeft; + image = RenderableHolder.CKLeft; + if (currentState == "attacking") { + if (gameLogic.getCounter() / 10 % 2 == 1) + image = RenderableHolder.CKLeftWalk1; + } } break; - + } gc.drawImage(image, screenX, screenY); @@ -79,11 +71,16 @@ public void update() { (int) (32)); if (currentState == "attacking") { if(canAttack) { + if(delay==0) { + attackState = true; attack(gameLogic.getPlayer()); + RenderableHolder.chicknightSound.play(0.2); + delay = 60; + } } else { - double xspeed = Math.cos(angle) * speed; - double yspeed = Math.sin(angle) * speed; + xspeed = Math.cos(angle) * speed; + yspeed = Math.sin(angle) * speed; if (yspeed < 0) @@ -108,7 +105,8 @@ public void update() { worldX += xspeed; } } - + if(delay==40) attackState = false; + if (delay>0) delay--; } updateAttackBlock(); diff --git a/src/logic/entity/Enemy.java b/src/logic/entity/Enemy.java index 7fb5dfb..59b0295 100644 --- a/src/logic/entity/Enemy.java +++ b/src/logic/entity/Enemy.java @@ -7,8 +7,6 @@ public abstract class Enemy extends Entity{ protected double angle = 0; - protected String currentState = "default"; - protected double delay = 0; protected boolean canAttack; protected double xspeed,yspeed; @@ -48,7 +46,6 @@ public int getCurrentHealth() { public void attack(Entity p) { // TODO Auto-generated method stub -// System.out.println(this.getClass().getSimpleName()+"Attack"); if (checkEnemyHit()) { ((Player) p).changeHealthTo(gameLogic.getPlayer().getCurrentHealth()-dmg); } @@ -63,7 +60,7 @@ public void drawHitbox(GraphicsContext gc) { public void drawAttackBlock(GraphicsContext gc) { gc.setFill(Color.BLACK); - gc.strokeRect(solidArea.getX(), attackBlock.getY(), attackBlock.getWidth(), + gc.strokeRect(attackBlock.getX(), attackBlock.getY(), attackBlock.getWidth(), attackBlock.getHeight()); } @@ -73,7 +70,6 @@ public void updateAttackBlock() { else if (direction == "left") attackBlock.setX(solidScreen.getX()+solidScreen.getWidth()-attackBlock.getWidth()); attackBlock.setY(screenY); - } public void update() { @@ -84,6 +80,9 @@ public void update() { } public void move() { + xspeed = Math.cos(angle) * speed; + yspeed = Math.sin(angle) * speed; + if (yspeed < 0) direction = "up"; else @@ -92,9 +91,8 @@ public void move() { gameLogic.checkTile(this); if (collisionOn == false) { worldY += yspeed; - } - + if (xspeed < 0) direction = "left"; else @@ -125,4 +123,4 @@ public boolean playerfound(int range) { public abstract void initSolidArea(); public abstract void initAttackBlock(); -} +} \ No newline at end of file diff --git a/src/logic/entity/Entity.java b/src/logic/entity/Entity.java index b488b8c..be28bd4 100644 --- a/src/logic/entity/Entity.java +++ b/src/logic/entity/Entity.java @@ -6,6 +6,8 @@ import sharedObject.IRenderable; public abstract class Entity implements IRenderable { + protected boolean attackState = false; + protected double delay = 0; protected double worldX, worldY; public double screenX, screenY; protected int z, radius; @@ -16,6 +18,7 @@ public abstract class Entity implements IRenderable { public Rectangle solidArea,solidScreen; public boolean collisionOn = false; public GameLogic gameLogic; + protected String currentState = "default"; // Status protected int maxHp; diff --git a/src/logic/entity/EyeOfQwifot.java b/src/logic/entity/EyeOfQwifot.java index ddd4043..5cfeb71 100644 --- a/src/logic/entity/EyeOfQwifot.java +++ b/src/logic/entity/EyeOfQwifot.java @@ -82,6 +82,7 @@ public void initAttackBlock() { attackBlock = new Rectangle(0,0,0,0); } + @Override public void changeHealthTo(int health) { if (health>=maxHp) { currentHealth = maxHp; diff --git a/src/logic/entity/GriszlyEye.java b/src/logic/entity/GriszlyEye.java index f819300..00031bc 100644 --- a/src/logic/entity/GriszlyEye.java +++ b/src/logic/entity/GriszlyEye.java @@ -73,6 +73,7 @@ public void update() { } if (delay ==30) { speed = normalSpeed*3; + RenderableHolder.griszlyEyeSound.play(0.1); xspeed = Math.cos(angle) * speed; yspeed = Math.sin(angle) * speed; } diff --git a/src/logic/entity/LlaristicKnight.java b/src/logic/entity/LlaristicKnight.java new file mode 100644 index 0000000..899f096 --- /dev/null +++ b/src/logic/entity/LlaristicKnight.java @@ -0,0 +1,142 @@ +package logic.entity; + +import Object.SwordBeam; +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.shape.Rectangle; +import logic.game.GameLogic; +import sharedObject.RenderableHolder; + +public class LlaristicKnight extends Enemy{ + + protected Rectangle normalAttackBlock; + private double probablility = 0.7; + private int xExtra,yExtra; + public LlaristicKnight(double x, double y, GameLogic gameLogic) { + super(x, y, gameLogic); + maxHp = 100; + currentHealth = maxHp; + z = -100; + dmg = 50; + speed = 1; + } + + @Override + public void draw(GraphicsContext gc) { + // TODO Auto-generated method stub + switch (direction) { + case "right": + if(currentState == "attacking") { + + if(delay>40) + image = RenderableHolder.CKRightAtk; + else { + if (delay / 10 % 2 == 1) + image = RenderableHolder.CKRightWalk1; + else + image = RenderableHolder.CKRight; + } + + } + else + image = RenderableHolder.CKRight; + break; + case "left": + if (currentState == "attacking") { + if (delay > 40) + image = RenderableHolder.CKLeftAtk; + else { + if (delay / 10 % 2 == 1) + image = RenderableHolder.CKLeftWalk1; + else + image = RenderableHolder.CKLeft; + } + + } else + image = RenderableHolder.CKLeft; + break; + + } + + gc.drawImage(image, screenX, screenY); + drawHitbox(gc); + drawAttackBlock(gc); + } + + @Override + public void update() { + super.update(); + if(currentState!="dead") { + if (playerfound(1000)) + currentState = "attacking"; + else + currentState = "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, 100); + if (currentState == "attacking") { + if(delay==0) { + delay = 60; + attack(player); + if(canAttack == ( Math.random()0) delay--; + } + updateAttackBlock(); + } + + public void specialMove() { + if (yspeed < 0) + direction = "up"; + else + direction = "down"; + setCollisionOn(false); + gameLogic.checkTile(this); + yExtra = (int) (yspeed * 500 * Math.random()); + if (collisionOn == false && (worldY + yExtra> 0 && worldY+yExtra< 64*47 )) { + worldY += yExtra; + } + + if (xspeed < 0) + direction = "left"; + else + direction = "right"; + + setCollisionOn(false); + gameLogic.checkTile(this); + xExtra = (int) (xspeed * 500 * Math.random()); + if (collisionOn == false && (worldX + xExtra> 0 && worldX+xExtra< 64*63 )) { + worldX += xExtra; + } + } + @Override + public void initSolidArea() { + // TODO Auto-generated method stub + solidArea = new Rectangle(20, 0, 24, 64); + } + + @Override + public void initAttackBlock() { + // TODO Auto-generated method stub + attackBlock = new Rectangle(0,0, solidArea.getWidth()+ 100, 64); + } + + @Override + public void changeHealthTo(int health) { + if (health>=maxHp) { + currentHealth = maxHp; + } + else if (health<=0) { + currentHealth = 0; + currentState = "dead"; + } + else { + currentHealth = health; + } + } +} \ No newline at end of file diff --git a/src/logic/entity/MagicalTortoise.java b/src/logic/entity/MagicalTortoise.java index ef47482..3870bd5 100644 --- a/src/logic/entity/MagicalTortoise.java +++ b/src/logic/entity/MagicalTortoise.java @@ -14,6 +14,7 @@ public class MagicalTortoise extends Entity{ public MagicalTortoise(double x, double y, GameLogic gameLogic) { super(x, y, gameLogic); this.dialogues = new ArrayList(); + z = -100; // TODO Auto-generated constructor stub setDialogues(); } @@ -60,15 +61,27 @@ public void update() { } public void setDialogues() { - dialogues.add("Hi , I'm GAY"); - dialogues.add("This is GayZone So u r Gay"); + dialogues.add("Goodluck Traveller!"); + dialogues.add("Hi , I'm Magical Tortoise"); + dialogues.add("You would be \"THE TRAVELLER\" \n in my prophecy"); + dialogues.add("This world will collapse soon"); + dialogues.add("Everything will be colorless"); + dialogues.add("People have no emotion"); + dialogues.add("You are the only one"); + dialogues.add("Please, save this world"); + dialogues.add("For the color of the world"); + dialogues.add("For the emotion of people"); + dialogues.add("Please, get rid of all 3 inverders"); + dialogues.add("The Eye of QWIFOT"); + dialogues.add("MoleDerKaiser"); + dialogues.add("LaristicKnight"); } public boolean playerfound(){ int rangeX = (int) Math.abs(worldX-gameLogic.getPlayer().getWorldX()); int rangeY = (int) Math.abs(worldY-gameLogic.getPlayer().getWorldY()); int range = (int) Math.sqrt(Math.pow(rangeX, 2) + Math.pow(rangeY, 2)); - return range<30; + return range<100; } public String getDialogues(int i) { return dialogues.get(i); diff --git a/src/logic/entity/Mole.java b/src/logic/entity/Mole.java index c1f8043..e91af54 100644 --- a/src/logic/entity/Mole.java +++ b/src/logic/entity/Mole.java @@ -1,59 +1,93 @@ package logic.entity; +import Object.Ball; +import Object.Projectile; import javafx.scene.canvas.GraphicsContext; +import javafx.scene.image.Image; import javafx.scene.shape.Rectangle; import logic.game.GameLogic; import sharedObject.RenderableHolder; public class Mole extends Enemy{ protected String rank; - public Mole(double x, double y, GameLogic gameLogic,String rank) { - super(x, y, gameLogic); + private int coolDown = 360; + private int height ,width; + private double x,y; + private Image deadImage; + public Mole(double x, double y, GameLogic gameLogic,String rank,int width,int height) { + super(x+(int)(Math.random()*width), y+ (int)(Math.random()*height), gameLogic); + this.height = height; + this.width = width; + this.x = x; + this.y = y; this.maxHp = 100; this.currentHealth = maxHp; this.z = -100; this.rank = rank; - if(rank=="DerKaiser") + if (rank == "DerKaiser") { image = RenderableHolder.moleDerKaiser; - else + deadImage = RenderableHolder.moleDerKaiserDead; + } else { image = RenderableHolder.mole; + deadImage = RenderableHolder.moleDead; + } } @Override public void draw(GraphicsContext gc) { // TODO Auto-generated method stub - gc.drawImage(image, screenX, screenX); + if(currentState=="attacking") + gc.drawImage(image, screenX, screenY); + else if (currentState=="dead") { + gc.drawImage(deadImage, screenX, screenY); + } + + drawHitbox(gc); + } + + public void attack() { + gameLogic.addNewProjectile(new Ball(worldX+solidArea.getX(), worldY+solidArea.getY(), angle,gameLogic)); } - @Override - public void update() { - // TODO Auto-generated method stub - super.update(); - if (playerfound(1000)) + public void update() { + // TODO Auto-generated method stub + super.update(); + if(currentState!="dead") { + System.out.println(currentHealth); + if (playerfound(800) && coolDown<180) currentState = "attacking"; else currentState = "default"; - if(currentState == "attacking") { - Player player = gameLogic.getPlayer(); - angle = Math.atan2(player.worldY - worldY, player.worldX - worldX); - double xDirection = Math.cos(Math.atan2(player.worldY-worldY,player.worldX-worldX)); - if(xDirection<0) - direction = "left"; - else - direction = "right"; - - if(delay==0) { - attack(gameLogic.getPlayer()); - delay = 1*60; - } - delay--; + if (currentState == "attacking") { + + if (delay == 0) { + attack(); + delay = 60; + } + delay--; } - } + if(coolDown==0) { + coolDown = 360; + System.out.println("yoooo"); + move(); + } + coolDown--; + } + } @Override public void initSolidArea() { solidArea = new Rectangle(16, 8, 32, 48); } - + @Override + public void move() { + worldX = x+ (int)(Math.random()*width); + worldY = y+ (int)(Math.random()*height); + System.out.println(worldX+" "+worldY); + } + @Override + public void changeHealthTo(int health) { + + } @Override public void initAttackBlock() { attackBlock = new Rectangle(0,0,0,0); diff --git a/src/logic/entity/MoleDerKaiser.java b/src/logic/entity/MoleDerKaiser.java index 445e5f7..8a81ea1 100644 --- a/src/logic/entity/MoleDerKaiser.java +++ b/src/logic/entity/MoleDerKaiser.java @@ -5,39 +5,35 @@ import logic.game.GameLogic; import sharedObject.RenderableHolder; -public class MoleDerKaiser extends Enemy{ - private int width = 7; - private int height = 7; - public MoleDerKaiser(double x, double y, GameLogic gameLogic) { - super(x, y, gameLogic); +public class MoleDerKaiser extends Mole{ + private Mole[] moles = new Mole [3]; + + public MoleDerKaiser(double x,double y,GameLogic gameLogic,int width,int height) { + super(x, y, gameLogic, "DerKaiser", width, height); this.maxHp = 100; - this.currentHealth = maxHp; - this.z = -100; - image = RenderableHolder.CKRight; - - // TODO Auto-generated constructor stub + this.gameLogic =gameLogic; + for(int i = 0;i<3;i++) { + moles[i] = new Mole(x,y,gameLogic,"",width,height); + } } - - @Override - public void draw(GraphicsContext gc) { - // TODO Auto-generated method stub - } - - @Override - public void update() { - - } - @Override - public void initSolidArea() { - // TODO Auto-generated method stub - solidArea = new Rectangle(16, 8, 32, 48); + public Mole[] getMoles() { + return moles; } - @Override - public void initAttackBlock() { - attackBlock = new Rectangle(0,0,0,0); - + public void changeHealthTo(int health) { + if (health>=maxHp) { + currentHealth = maxHp; + } + else if (health<=0) { + currentHealth = 0; + currentState = "dead"; + for(int i = 0;i<3;i++) { + moles[i].currentState = "dead"; + } + } + else { + currentHealth = health; + } } - } diff --git a/src/logic/entity/Player.java b/src/logic/entity/Player.java index 5254704..7a74e89 100644 --- a/src/logic/entity/Player.java +++ b/src/logic/entity/Player.java @@ -10,219 +10,281 @@ import sharedObject.IRenderable; import sharedObject.RenderableHolder; -public class Player extends Entity{ - - - private String attackState = "no"; - - //Status Position - private int statusBarWidth = (int) (180*1.5); - private int statusBarHeight = (int) (38*2); - private int statusBarX = (int) (10*1.5); - private int statusBarY = (int) (10*1.5); - - //Bar Position - private int healthBarWidth = (int) (144*1.5); - private int healthBarHeight = (int) (4*2); - private int healthBarX = (int) (30*1.5); - private int healthBarY = (int) (11*1.5); - - //Status - protected int maxHp = 50; +public class Player extends Entity { + + // Status Position + private int statusBarWidth = (int) (180 * 1.5); + private int statusBarHeight = (int) (38 * 2); + private int statusBarX = (int) (10 * 1.5); + private int statusBarY = (int) (10 * 1.5); + + // Bar Position + private int healthBarWidth = (int) (144 * 1.5); + private int healthBarHeight = (int) (4 * 2); + private int healthBarX = (int) (30 * 1.5); + private int healthBarY = (int) (11 * 1.5); + + private int manaBarWidth = (int) (97 * 1.5); + private int manaBarHeight = (int) (2 * 2); + private int manaBarX = (int) (42 * 1.5); + private int manaBarY = (int) (30 * 1.5); + + // Status + protected int maxHp = 5000; protected int currentHealth = maxHp; protected float healthWidth = healthBarWidth; + protected int maxMana = 100; + protected int currentMana = 0; + protected float manaWidth = currentMana; protected int dmg = 10; protected int iframe = 0; - - //AttackBlock + protected int duration = 0; + + // AttackBlock private Rectangle attackBlock; - + int counter; - public Player(double x, double y,GameLogic gameLogic) { - super(x,y,gameLogic); - this.speed = 5; - screenX = gameLogic.getGameScreen().getWidth()/2-radius; - screenY = gameLogic.getGameScreen().getHeight()/2-radius; + public Player(double x, double y, GameLogic gameLogic) { + super(x, y, gameLogic); + this.speed = 5; + z = -100; + screenX = gameLogic.getGameScreen().getWidth() / 2 - radius; + screenY = gameLogic.getGameScreen().getHeight() / 2 - radius; image = RenderableHolder.playerRight; initSolidArea(); initAttackBlock(); } + @Override public void draw(GraphicsContext gc) { - image = RenderableHolder.playerRight; // TODO Auto-generated method stub - switch(direction) { + switch (direction) { case "left": - image = (RenderableHolder.playerLeft); + if (attackState) + image = RenderableHolder.playerLeftAtk; + else { + image = RenderableHolder.playerLeft; + if (currentState == "moving") { + if (gameLogic.getCounter() / 10 % 2 == 1) + image = RenderableHolder.playerLeftWalk; + } + } break; case "right": - image = RenderableHolder.playerRight; + if (attackState) + image = RenderableHolder.playerRightAtk; + else { + image = RenderableHolder.playerRight; + if (currentState == "moving") { + if (gameLogic.getCounter() / 10 % 2 == 1) + image = RenderableHolder.playerRightWalk; + } + } break; - } - gc.drawImage(image , screenX, screenY); + } + gc.drawImage(image, screenX, screenY); drawUI(gc); - - //Debugging + + // Debugging drawHitbox(gc); drawAttackBlock(gc); } - + public void drawHitbox(GraphicsContext gc) { gc.setLineWidth(2); gc.setFill(Color.PINK); - gc.strokeRect(solidScreen.getX(),solidScreen.getY(),solidScreen.getWidth(),solidScreen.getHeight()); + gc.strokeRect(solidScreen.getX(), solidScreen.getY(), solidScreen.getWidth(), solidScreen.getHeight()); } - + public void drawUI(GraphicsContext gc) { gc.drawImage(RenderableHolder.healthBar, statusBarX, statusBarY, statusBarWidth, statusBarHeight); gc.setFill(Color.BLACK); - gc.fillRect(healthBarX+statusBarX,healthBarY+statusBarY,healthWidth,healthBarHeight); + gc.fillRect(healthBarX + statusBarX, healthBarY + statusBarY, healthWidth, healthBarHeight); + gc.setFill(Color.LIGHTGRAY); + gc.fillRect(manaBarX + statusBarX, manaBarY + statusBarY, manaWidth, manaBarHeight); } - - public void drawAttackBlock(GraphicsContext gc){ + + 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()); } - + public void attack(Entity e) { - - attackState = "yes"; - Enemy enemy = (Enemy)e; - System.out.println("Player Attack "+e.getClass().getSimpleName()); - enemy.changeHealthTo(enemy.getCurrentHealth()-dmg); - - + Enemy enemy = (Enemy) e; + System.out.println("Player Attack " + e.getClass().getSimpleName()); + enemy.changeHealthTo(enemy.getCurrentHealth() - dmg); + changeManaTo(currentMana + 100); } + + public void skill() { + RenderableHolder.playerSkill.play(); + duration = 10 * 60; + speed = 10; + dmg = 20; + changeManaTo(currentMana - 100); + } + @Override public void update() { // TODO Auto-generated method stub - solidScreen = new Rectangle(screenX+solidArea.getX(),screenY+solidArea.getY(),solidArea.getWidth(),solidArea.getHeight()); + solidScreen = new Rectangle(screenX + solidArea.getX(), screenY + solidArea.getY(), solidArea.getWidth(), + solidArea.getHeight()); move(); if (InputUtility.isLeftClickTriggered()) { - for (Entity entity: gameLogic.getGameObjectContainer()) { - if ((entity instanceof Enemy)) { - Enemy enemy = ((Enemy)entity); - int x = (int) enemy.solidScreen.getX(); - int y = (int) enemy.solidScreen.getY(); - int width = (int) enemy.getSolidArea().getWidth(); - int height = (int) enemy.getSolidArea().getHeight(); - attackBlock.intersects(x,y,width,height); - if (attackBlock.intersects(x,y,width,height)) { - attack(entity); - } - if(enemy instanceof EyeOfQwifot) { -// System.out.println(enemy.solidScreen.getWidth()+" "+enemy.solidScreen.getHeight()); + + if (delay == 0) { + attackState = true; + RenderableHolder.sword1.play(0.2); + for (Entity entity : gameLogic.getGameObjectContainer()) { + if ((entity instanceof Enemy)) { + Enemy enemy = ((Enemy) entity); + int x = (int) enemy.solidScreen.getX(); + int y = (int) enemy.solidScreen.getY(); + int width = (int) enemy.getSolidArea().getWidth(); + int height = (int) enemy.getSolidArea().getHeight(); + attackBlock.intersects(x, y, width, height); + if (attackBlock.intersects(x, y, width, height)) { + attack(entity); + } } - } + delay = 20; } - } - + if (InputUtility.getKeyPressed(KeyCode.SPACE) && currentMana >= 100) { + skill(); + InputUtility.getKeyPressed().remove(KeyCode.SPACE); + } + updateHealthBar(); updateAttackBlock(); - if(iframe>0)iframe--; + if (iframe > 0) + iframe--; + + if (delay == 10) + attackState = false; + if (delay > 0) + delay--; + + if (duration > 0) + duration--; + if (duration == 0) { + speed = 5; + dmg = 10; + } } - + public void updateHealthBar() { - healthWidth = (float) (currentHealth/(float) maxHp) * healthBarWidth; + healthWidth = (float) (currentHealth / (float) maxHp) * healthBarWidth; + manaWidth = (float) (currentMana / (float) maxMana) * manaBarWidth; } - + public void changeHealthTo(int health) { - if(iframe == 0){ - if (health>=maxHp) { + if (iframe == 0) { + if (health >= maxHp) { currentHealth = maxHp; - } - else if (health<=0) { + } else if (health <= 0) { currentHealth = 0; // GameOver(); - } - else { + } else { currentHealth = health; - System.out.println("Plathong" + currentHealth); } iframe = 30; } - + } - + public void move() { - direction = ""; + currentState = "moving"; if (InputUtility.getKeyPressed(KeyCode.W)) { direction = "up"; - } - if (InputUtility.getKeyPressed(KeyCode.S)) { + } else if (InputUtility.getKeyPressed(KeyCode.S)) { direction = "down"; - } - - setCollisionOn(false); - gameLogic.checkTile(this); - - if (collisionOn == false) { - switch(direction) { - case "up": - worldY -= speed; - break; - case "down": - worldY += speed; - break; + } else + currentState = "default"; + if (currentState == "moving") { + setCollisionOn(false); + gameLogic.checkTile(this); + + if (collisionOn == false) { + switch (direction) { + case "up": + worldY -= speed; + break; + case "down": + worldY += speed; + break; + } } } - + currentState = "moving"; if (InputUtility.getKeyPressed(KeyCode.D)) { direction = "right"; - } - if (InputUtility.getKeyPressed(KeyCode.A)) { + } else if (InputUtility.getKeyPressed(KeyCode.A)) { direction = "left"; - } - - setCollisionOn(false); - gameLogic.checkTile(this); - if (collisionOn == false) { - switch(direction) { - case "left": - worldX -= speed; - break; - case "right": - worldX += speed; - break; + } else + currentState = "default"; + + if (currentState == "moving") { + setCollisionOn(false); + gameLogic.checkTile(this); + if (collisionOn == false) { + switch (direction) { + case "left": + worldX -= speed; + break; + case "right": + worldX += speed; + break; + } } } } + public void initSolidArea() { - solidArea = new Rectangle(16,0,32,64); + solidArea = new Rectangle(16, 0, 32, 64); } - + public void initAttackBlock() { - attackBlock = new Rectangle(screenX,screenY,solidArea.getWidth()+20*2,96); + attackBlock = new Rectangle(screenX, screenY, solidArea.getWidth() + 20 * 2, 96); } - + public void updateAttackBlock() { if (direction == "right") attackBlock.setX(solidScreen.getX()); else if (direction == "left") - attackBlock.setX(solidScreen.getX()+solidScreen.getWidth()-attackBlock.getWidth()); - attackBlock.setY(screenY-16); + attackBlock.setX(solidScreen.getX() + solidScreen.getWidth() - attackBlock.getWidth()); + attackBlock.setY(screenY - 16); } - + public void GameOver() { System.exit(0); } + public int getCurrentHealth() { return currentHealth; } - public void setCurrentHealth(int currentHealth) { - this.currentHealth = currentHealth; + + public void changeManaTo(int mana) { + if (mana >= maxMana) { + currentMana = maxMana; + } else if (mana <= 0) { + currentMana = 0; + } else { + currentMana = mana; + } + iframe = 30; + } - - public void reset() { + + public void reset() { visible = true; destroyed = false; worldX = getWorldX(); worldY = getWorldY(); this.currentHealth = maxHp; - } + } } diff --git a/src/logic/entity/ShadowPot.java b/src/logic/entity/ShadowPot.java index 4097692..025e076 100644 --- a/src/logic/entity/ShadowPot.java +++ b/src/logic/entity/ShadowPot.java @@ -1,96 +1,93 @@ package logic.entity; +import Object.Ball; import Object.Projectile; import javafx.scene.canvas.GraphicsContext; import javafx.scene.shape.Rectangle; import logic.game.GameLogic; import sharedObject.RenderableHolder; -public class ShadowPot extends Enemy{ +public class ShadowPot extends Enemy { - public ShadowPot(double x, double y, GameLogic gameLogic) { - super(x, y, gameLogic); - image = RenderableHolder.SPRight1; - maxHp = 10; - currentHealth = maxHp; - delay = 1*60; - } + public ShadowPot(double x, double y, GameLogic gameLogic) { + super(x, y, gameLogic); + image = RenderableHolder.SPRight1; + maxHp = 10; + currentHealth = maxHp; + delay = 1 * 60; + } - @Override - public void draw(GraphicsContext gc) { - // TODO Auto-generated method stub - switch(direction) { - case "right": - if (gameLogic.getCounter()<20) - if(currentState == "attacking") - image = RenderableHolder.SPRightAtk; - else - image = RenderableHolder.SPRight1; + @Override + public void draw(GraphicsContext gc) { + // TODO Auto-generated method stub + switch (direction) { + case "right": + if (gameLogic.getCounter() < 20) + if (currentState == "attacking") + image = RenderableHolder.SPRightAtk; + else + image = RenderableHolder.SPRight1; - else - image = RenderableHolder.SPRight2; - break; - case "left": - if (gameLogic.getCounter()<20) - if(currentState == "attacking") - image = RenderableHolder.SPLeftAtk; - else - image = RenderableHolder.SPLeft1; + else + image = RenderableHolder.SPRight2; + break; + case "left": + if (gameLogic.getCounter() < 20) + if (currentState == "attacking") + image = RenderableHolder.SPLeftAtk; + else + image = RenderableHolder.SPLeft1; - else - image = RenderableHolder.SPLeft2; + else + image = RenderableHolder.SPLeft2; - break; - } - gc.drawImage(image, screenX, screenY); - // TODO Auto-generated method stub - drawHitbox(gc); - } + break; + } + gc.drawImage(image, screenX, screenY); + // TODO Auto-generated method stub + drawHitbox(gc); + } - @Override - public void attack(Entity t) { + public void attack() { // TODO Auto-generated method stub - - Projectile projectile = new Projectile(worldX+solidArea.getX(), worldY+solidArea.getY(), angle,gameLogic); - gameLogic.addNewProjectile(projectile); + + gameLogic.addNewProjectile(new Ball(worldX+solidArea.getX(), worldY+solidArea.getY(), angle,gameLogic)); } - @Override - public void update() { - // TODO Auto-generated method stub - super.update(); - if (playerfound(1000)) + @Override + public void update() { + // TODO Auto-generated method stub + super.update(); + if (playerfound(1000)) currentState = "attacking"; else currentState = "default"; - if(currentState == "attacking") { - Player player = gameLogic.getPlayer(); - angle = Math.atan2(player.worldY - worldY, player.worldX - worldX); - double xDirection = Math.cos(Math.atan2(player.worldY-worldY,player.worldX-worldX)); - if(xDirection<0) - direction = "left"; - else - direction = "right"; - - if(delay==0) { - - attack(gameLogic.getPlayer()); - delay = 1*60; - } - delay--; + if (currentState == "attacking") { + double xDirection = Math.cos(angle); + if (xDirection < 0) + direction = "left"; + else + direction = "right"; + + if (delay == 0) { + + attack(); + delay = 1 * 60; + } + delay--; } - } + } @Override public void initSolidArea() { // TODO Auto-generated method stub - solidArea = new Rectangle(16,24,32,40); + solidArea = new Rectangle(16, 24, 32, 40); } @Override public void initAttackBlock() { // TODO Auto-generated method stub - attackBlock = new Rectangle(0,0,0,0); + attackBlock = new Rectangle(0, 0, 0, 0); } } \ No newline at end of file diff --git a/src/logic/field/Map1.java b/src/logic/field/Map1.java index fd62266..2733c82 100644 --- a/src/logic/field/Map1.java +++ b/src/logic/field/Map1.java @@ -11,7 +11,7 @@ public class Map1 implements IRenderable{ public GameLogic gL; // private WritableImage[] croppedImage = new WritableImage[4]; - private Tile [] tiles = new Tile[20]; + private Tile [] tiles = new Tile[29]; public Map1(GameLogic gameLogic) { this.gL = gameLogic; @@ -32,54 +32,66 @@ public Map1(GameLogic gameLogic) { tiles[14] = new Tile( RenderableHolder.tombTile,true); tiles[15] = new Tile( RenderableHolder.spawn1Tile,false); tiles[16] = new Tile(RenderableHolder.spawn2Tile,false); + tiles[17] = new Tile(RenderableHolder.waterTopTile,false); + tiles[18] = new Tile(RenderableHolder.waterBottomTile, false); + tiles[19] = new Tile(RenderableHolder.waterLeftTile,false); + tiles[20] = new Tile(RenderableHolder.waterRightTile,false); + tiles[21] = new Tile(RenderableHolder.waterTopLeftTile,false); + tiles[22] = new Tile(RenderableHolder.waterTopRightTile,false); + tiles[23] = new Tile(RenderableHolder.waterBottomLeftTile,false); + tiles[24] = new Tile(RenderableHolder.waterBottomRightTile,false); + tiles[25] = new Tile(RenderableHolder.waterEdge1,false); + tiles[26] = new Tile(RenderableHolder.waterEdge2,false); + tiles[27] = new Tile(RenderableHolder.waterEdge3,false); + tiles[28] = new Tile(RenderableHolder.waterEdge4,false); } int tileSize = 64; public int[][] field = {{6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7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,0,0,0,0,0,0,0,0,0,0,9}, {13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {13,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, - {13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, + {13,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, + {13,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, {13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9}, {12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10}}; diff --git a/src/logic/game/GameLogic.java b/src/logic/game/GameLogic.java index 314a9b2..bb7ae84 100644 --- a/src/logic/game/GameLogic.java +++ b/src/logic/game/GameLogic.java @@ -20,7 +20,10 @@ import logic.entity.Entity; import logic.entity.EyeOfQwifot; import logic.entity.GriszlyEye; +import logic.entity.LlaristicKnight; import logic.entity.MagicalTortoise; +import logic.entity.Mole; +import logic.entity.MoleDerKaiser; import logic.entity.Player; import logic.entity.ShadowPot; import logic.field.Map1; @@ -37,7 +40,8 @@ public class GameLogic { private EyeOfQwifot eQ; private Map1 map; private MagicalTortoise mT; - + private MoleDerKaiser mDK; + private LlaristicKnight LN; // GameState public int gameState = 1; public final int playState = 1; @@ -45,6 +49,8 @@ public class GameLogic { public final int npcState = 3; public final int gameOverState = 4; + public int dialogueIndex = 0; + public GameLogic(GameScreen gameScreen) { this.gameScreen = gameScreen; startNewGame(); @@ -70,23 +76,51 @@ public void startNewGame() { this.gameObjectContainer = new ArrayList(); this.projectilesContainer = new ArrayList(); RenderableHolder.getInstance().getEntities().clear(); - map = new Map1(this); RenderableHolder.getInstance().add(map); - - player = new Player(384, 288, this); + + player = new Player(1920, 1444, this); eQ = new EyeOfQwifot(3456, 512, this); - mT = new MagicalTortoise(200, 200, this); + mT = new MagicalTortoise(2040, 1444, this); addNewObject(player); - addNewObject(new Chicknight(200, 200, this)); + addNewObject(new Chicknight(3000, 200, this)); + for (int i = 0; i < 50; i++) { + double pointX = Math.random(); + double pointY = Math.random(); + boolean spawnPoint = ((pointX>0.4 && pointX<0.6) || (pointY>0.4 &&pointY<0.6)); + while (pointX < 0.05 || pointX > 0.95 || pointY < 0.05 || pointY > 0.95 || spawnPoint) { + pointX = Math.random(); + pointY = Math.random(); + spawnPoint = ((pointX>0.4 && pointX<0.6) || (pointY>0.4 &&pointY<0.6)); + } + addNewObject(new Chicknight(pointX * 64 * 64, pointY * 64 * 48, this)); + } + + for (int i = 0; i < 20; i++) { + double pointX = Math.random(); + double pointY = Math.random(); + boolean spawnPoint = ((pointX>0.4 && pointX<0.6) || (pointY>0.4 &&pointY<0.6)); + while (pointX < 0.05 || pointX > 0.95 || pointY < 0.05 || pointY > 0.95 || spawnPoint) { + pointX = Math.random(); + pointY = Math.random(); + spawnPoint = ((pointX>0.4 && pointX<0.6) || (pointY>0.4 &&pointY<0.6)); + } + addNewObject(new ShadowPot(pointX * 64 * 64, pointY * 64 * 48, this)); + } addNewObject(mT); - addNewObject(new GriszlyEye(200, 200, this)); - addNewObject(eQ); - addNewObject(new ShadowPot(300, 500, this)); - + addNewObject(new LlaristicKnight(8*64, 10*64, this)); + addNewObject(new GriszlyEye(3000, 200, this)); + addNewObject(new ShadowPot(3000, 500, this)); + addNewObject(new EyeOfQwifot(3456, 512, this)); + mDK = new MoleDerKaiser(1800, 64*37, this, 448, 448); + addNewObject(mDK); + for (Mole m : mDK.getMoles()) { + addNewObject(m); + } gameState = playState; System.out.println("New Game"); } + public void checkTile(Entity entity) { int entityLeftWorldX = (int) (entity.getWorldX() + entity.solidArea.getX()); int entityRightWorldX = (int) (entity.getWorldX() + entity.solidArea.getX() + entity.solidArea.getWidth()); @@ -106,9 +140,6 @@ public void checkTile(Entity entity) { entityTopRow = (entityTopWorldY - entity.getSpeed()) / map.getTileSize(); tile1 = map.getTileIndex(entityLeftCol, entityTopRow); tile2 = map.getTileIndex(entityRightCol, entityTopRow); -// tile1 = map.field[entityLeftCol][entityTopRow]; -// tile2 = map.field[entityRightCol][entityTopRow]; - if (map.getTiles()[tile1].collision == true || map.getTiles()[tile2].collision == true) { entity.setCollisionOn(true); } @@ -117,8 +148,6 @@ public void checkTile(Entity entity) { entityBottomRow = (entityBottomWorldY + entity.getSpeed()) / map.getTileSize(); tile1 = map.getTileIndex(entityLeftCol, entityBottomRow); tile2 = map.getTileIndex(entityRightCol, entityBottomRow); -// tile1 = map.field[entityLeftCol][entityBottomRow]; -// tile2 = map.field[entityRightCol][entityBottomRow]; if (map.getTiles()[tile1].collision == true || map.getTiles()[tile2].collision == true) { entity.setCollisionOn(true); } @@ -127,8 +156,6 @@ public void checkTile(Entity entity) { entityLeftCol = (entityLeftWorldX - entity.getSpeed()) / map.getTileSize(); tile1 = map.getTileIndex(entityLeftCol, entityTopRow); tile2 = map.getTileIndex(entityLeftCol, entityBottomRow); -// tile1 = map.field[entityLeftCol][entityTopRow]; -// tile2 = map.field[entityLeftCol][entityBottomRow]; if (map.getTiles()[tile1].collision == true || map.getTiles()[tile2].collision == true) { entity.setCollisionOn(true); } @@ -137,8 +164,6 @@ public void checkTile(Entity entity) { entityRightCol = (entityRightWorldX + entity.getSpeed()) / map.getTileSize(); tile1 = map.getTileIndex(entityRightCol, entityTopRow); tile2 = map.getTileIndex(entityRightCol, entityBottomRow); -// tile1 = map.field[entityRightCol][entityTopRow]; -// tile2 = map.field[entityRightCol][entityBottomRow]; if (map.getTiles()[tile1].collision == true || map.getTiles()[tile2].collision == true) { entity.setCollisionOn(true); } @@ -152,33 +177,45 @@ public void update() { if (!RenderableHolder.inGameSong.isPlaying()) { RenderableHolder.inGameSong.play(); } - if(gameState == playState) { - logicUpdate(); - gameScreen.paintComponent(); - } - else if (gameState == pauseState) { + if (gameState == playState) { + logicUpdate(); + gameScreen.paintComponent(); + } else if (gameState == pauseState) { drawGamePauseOverlay(); + if (InputUtility.getKeyPressed(KeyCode.M)) { + Main.GoToMenu(); + RenderableHolder.inGameSong.stop(); + InputUtility.getKeyPressed().remove(KeyCode.M); + } // System.out.println(500); - }else if (gameState == gameOverState) { + } else if (gameState == gameOverState) { drawGameOverOverlay(); RenderableHolder.inGameSong.stop(); if (InputUtility.getKeyPressed(KeyCode.R)) { startNewGame(); // reset(); - } - else if ( InputUtility.getKeyPressed(KeyCode.M)) { + } else if (InputUtility.getKeyPressed(KeyCode.M)) { InputUtility.getKeyPressed().remove(KeyCode.M); Main.GoToMenu(); } - } - else if (gameState == npcState) { - drawDialogueScreen(0); + } else if (gameState == npcState) { + if (!getMagicalTortoise().playerfound()) { + + gameState = playState; + dialogueIndex = 0; + } logicUpdate(); gameScreen.paintComponent(); + drawDialogueScreen(dialogueIndex); + if (InputUtility.isLeftClickTriggered()) { + dialogueIndex++; + RenderableHolder.npcSound.play(0.2); + } + if (getMagicalTortoise().getDialoguesSize() - 1 < dialogueIndex) + dialogueIndex = 0; } } - public void logicUpdate() { if (counter == 60) { counter = 0; @@ -261,8 +298,7 @@ public void checkGameState() { if (gameState == playState) { gameState = npcState; - } - else if (gameState == npcState) { + } else if (gameState == npcState) { int total = getMagicalTortoise().getDialoguesSize() - 1; if (start < total) { drawDialogueScreen(start); diff --git a/src/sharedObject/RenderableHolder.java b/src/sharedObject/RenderableHolder.java index 87d9cae..742b6de 100644 --- a/src/sharedObject/RenderableHolder.java +++ b/src/sharedObject/RenderableHolder.java @@ -15,15 +15,7 @@ public class RenderableHolder { private List entities; private Comparator comparator; - public static Image playerLeft; - public static Image playerRight; - public static Image playerRightAtk; - public static Image johnSprite; - public static Image whiteTile; - public static Image grayTile; - public static Image pathTile; - public static Image blackStarTile; - public static Image blackTile; + public static Image playerLeft,playerLeftWalk,playerLeftAtk,playerRight,playerRightWalk,playerRightAtk; public static Image CKLeft, CKLeftWalk1, CKLeftWalk2, CKLeftAtk, CKRight, CKRightWalk1, CKRightWalk2, CKRightAtk; public static Image gameOverOverlay, pauseOverlay, pauseMenu, soundButton, urm, volumeButton; public static Image GELeft, GELeftWalk, GELeftWalk2, GERight, GERightWalk, GERightWalk2; @@ -34,13 +26,15 @@ public class RenderableHolder { // EyeOfQwifot Sprite public static Image EQ1, EQ2, EQDead1, EQDead2; //MoleDerKaiser - public static Image mole,moleDerKaiser; + public static Image mole,moleDerKaiser,moleDead,moleDerKaiserDead; public static Image moonSprite; public static Image healthBar; - //Song - public static AudioClip inGameSong; + //Song & Effect + public static AudioClip inGameSong,sword1,chicknightSound,shootSound,griszlyEyeSound,npcSound,playerSkill,monsterdie; // Map Tile - public static Image ground1Tile,ground2Tile,ground3Tile,water1Tile,water2Tile,topLeftMapTile,topMapTile,topRightMapTile, + public static Image ground1Tile,ground2Tile,ground3Tile,water1Tile,water2Tile,waterTopTile,waterBottomTile, + waterLeftTile,waterRightTile,waterTopLeftTile,waterTopRightTile,waterBottomLeftTile,waterBottomRightTile, + waterEdge1,waterEdge2,waterEdge3,waterEdge4,topLeftMapTile,topMapTile,topRightMapTile, rightMapTile,bottomRightMapTile,bottomMapTile,bottomLeftMapTile,leftMapTile,tombTile,spawn1Tile,spawn2Tile; static { loadResource(); @@ -76,20 +70,33 @@ public static void loadResource() { loadShadowPot(); loadEyeOfQwifot(); loadMoleDerKaiser(); + loadSound(); // //Game State pauseOverlay = new Image(ClassLoader.getSystemResource("pause/PauseOverlay.png").toString()); gameOverOverlay = new Image(ClassLoader.getSystemResource("pause/GameOver.png").toString()); - inGameSong = new AudioClip(ClassLoader.getSystemResource("IngameSong.wav").toString()); // StatusBar healthBar = new Image(ClassLoader.getSystemResource("health_power_bar.png").toString()); } + public static void loadSound() { + inGameSong = new AudioClip(ClassLoader.getSystemResource("sound/IngameSong.wav").toString()); + chicknightSound = new AudioClip(ClassLoader.getSystemResource("sound/chicknight.mp3").toString()); + shootSound = new AudioClip(ClassLoader.getSystemResource("sound/shootSound.mp3").toString()); + sword1 = new AudioClip(ClassLoader.getSystemResource("sound/swing.mp3").toString()); + griszlyEyeSound = new AudioClip(ClassLoader.getSystemResource("sound/GriszlyEyeSound.wav").toString()); + npcSound = new AudioClip(ClassLoader.getSystemResource("sound/npcSound.wav").toString()); + playerSkill = new AudioClip(ClassLoader.getSystemResource("sound/skill1.wav").toString()); + monsterdie = new AudioClip(ClassLoader.getSystemResource("sound/monsterdie.wav").toString()); + } public static void loadPlayer() { - playerLeft = new Image(ClassLoader.getSystemResource("player/RabbiLeft.png").toString()); - playerRight = new Image(ClassLoader.getSystemResource("player/Rabbi.png").toString()); - playerRightAtk = new Image(ClassLoader.getSystemResource("player/RabbiRightAtk.png").toString()); + playerLeft = new Image(ClassLoader.getSystemResource("player/playerLeft.png").toString()); + playerLeftWalk = new Image(ClassLoader.getSystemResource("player/playerLeftWalk.png").toString()); + playerLeftAtk = new Image(ClassLoader.getSystemResource("player/playerLeftAtk.png").toString()); + playerRight = new Image(ClassLoader.getSystemResource("player/playerRight.png").toString()); + playerRightWalk = new Image(ClassLoader.getSystemResource("player/playerRightWalk.png").toString()); + playerRightAtk = new Image(ClassLoader.getSystemResource("player/playerRightAtk.png").toString()); } public static void loadMapTile() { ground1Tile = new Image(ClassLoader.getSystemResource("mapTile/ground1.png").toString()); @@ -97,6 +104,18 @@ public static void loadMapTile() { ground3Tile = new Image(ClassLoader.getSystemResource("mapTile/ground3.png").toString()); water1Tile = new Image(ClassLoader.getSystemResource("mapTile/water1.png").toString()); water2Tile = new Image(ClassLoader.getSystemResource("mapTile/water2.png").toString()); + waterTopTile = new Image(ClassLoader.getSystemResource("mapTile/waterTop.png").toString()); + waterBottomTile = new Image(ClassLoader.getSystemResource("mapTile/waterBottom.png").toString()); + waterLeftTile = new Image(ClassLoader.getSystemResource("mapTile/waterLeft.png").toString()); + waterRightTile = new Image(ClassLoader.getSystemResource("mapTile/waterRight.png").toString()); + waterTopRightTile = new Image(ClassLoader.getSystemResource("mapTile/waterTopRight.png").toString()); + waterBottomRightTile = new Image(ClassLoader.getSystemResource("mapTile/waterBottomRight.png").toString()); + waterTopLeftTile = new Image(ClassLoader.getSystemResource("mapTile/waterTopLeft.png").toString()); + waterBottomLeftTile = new Image(ClassLoader.getSystemResource("mapTile/waterBottomLeft.png").toString()); + waterEdge1 = new Image(ClassLoader.getSystemResource("mapTile/waterEdge1.png").toString()); + waterEdge2 = new Image(ClassLoader.getSystemResource("mapTile/waterEdge2.png").toString()); + waterEdge3 = new Image(ClassLoader.getSystemResource("mapTile/waterEdge3.png").toString()); + waterEdge4 = new Image(ClassLoader.getSystemResource("mapTile/waterEdge4.png").toString()); topLeftMapTile = new Image(ClassLoader.getSystemResource("mapTile/TopLeftMap.png").toString()); topMapTile = new Image(ClassLoader.getSystemResource("mapTile/TopMap.png").toString()); topRightMapTile = new Image(ClassLoader.getSystemResource("mapTile/TopRightMap.png").toString()); @@ -151,6 +170,8 @@ public static void loadShadowPot() { public static void loadMoleDerKaiser() { mole = new Image(ClassLoader.getSystemResource("MoleDerKaiser/normalMole.png").toString()); moleDerKaiser = new Image(ClassLoader.getSystemResource("MoleDerKaiser/moleDerKaiser.png").toString()); + moleDead = new Image(ClassLoader.getSystemResource("MoleDerKaiser/normalMoleDead.png").toString()); + moleDerKaiserDead = new Image(ClassLoader.getSystemResource("MoleDerKaiser/moleDerKaiserDead.png").toString()); } public void add(IRenderable entity) { System.out.println("add");