Skip to content
Snippets Groups Projects
Commit 2c3f7b5e authored by aarnereime's avatar aarnereime
Browse files

La til en hvit border rundt tekstboksene, og fikset koordinatene når du dør.

parent 28819087
No related branches found
No related tags found
No related merge requests found
...@@ -67,11 +67,11 @@ public class Checkpoint implements IGameObject { ...@@ -67,11 +67,11 @@ public class Checkpoint implements IGameObject {
gc.drawImage(checkpointImg, (this.x - this.w/2.0) - player.getX() + player.screenX, this.y - this.h/2.0, this.w, this.h); gc.drawImage(checkpointImg, (this.x - this.w/2.0) - player.getX() + player.screenX, this.y - this.h/2.0, this.w, this.h);
} }
public void drawCheckpointText(GraphicsContext gc) { public void drawCheckpointText(GraphicsContext gc, double w, double h) {
int width = 240; int width = 240;
int height = 50; int height = 50;
double x = (900/2.0) - width/2.0; double x = w/2 - width/2;
double y = 100; double y = h/3.5 - height/2;
gc.setFill(Color.rgb(0, 0, 0, 0.8)); gc.setFill(Color.rgb(0, 0, 0, 0.8));
gc.fillRoundRect(x, y, width, height, 35, 35); gc.fillRoundRect(x, y, width, height, 35, 35);
...@@ -80,6 +80,10 @@ public class Checkpoint implements IGameObject { ...@@ -80,6 +80,10 @@ public class Checkpoint implements IGameObject {
gc.setFont(new Font("Comic sans MS", 20)); gc.setFont(new Font("Comic sans MS", 20));
gc.fillText("Checkpoint updated", x + 20, y + 30); gc.fillText("Checkpoint updated", x + 20, y + 30);
gc.restore(); gc.restore();
gc.setStroke(Color.WHITE);
gc.setLineWidth(5);
gc.strokeRoundRect(x, y, width, height, 35, 35);
} }
} }
...@@ -6,6 +6,8 @@ import javafx.scene.image.Image; ...@@ -6,6 +6,8 @@ import javafx.scene.image.Image;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.text.Font; import javafx.scene.text.Font;
import java.awt.*;
public class NPC implements IGameObject{ public class NPC implements IGameObject{
int x, y, w, h, drawW; int x, y, w, h, drawW;
Image i1, i2, i3, i4, i5, i6; Image i1, i2, i3, i4, i5, i6;
...@@ -114,6 +116,10 @@ public class NPC implements IGameObject{ ...@@ -114,6 +116,10 @@ public class NPC implements IGameObject{
gc.fillText("Who goes there! Oh greetings,\n young traveler. I have heard\n a rumor that there is " + gc.fillText("Who goes there! Oh greetings,\n young traveler. I have heard\n a rumor that there is " +
"a mighty fine\ntreasure for the one who dear cross\n the forbidden lands.", x + 20, y + 50); "a mighty fine\ntreasure for the one who dear cross\n the forbidden lands.", x + 20, y + 50);
gc.restore(); gc.restore();
gc.setStroke(Color.WHITE);
gc.setLineWidth(5);
gc.strokeRoundRect(x, y, width, height, 35, 35);
} }
public void drawInteractableOption(GraphicsContext gc, double w, double h) { public void drawInteractableOption(GraphicsContext gc, double w, double h) {
...@@ -129,6 +135,10 @@ public class NPC implements IGameObject{ ...@@ -129,6 +135,10 @@ public class NPC implements IGameObject{
gc.setFont(new Font("Comic sans MS", 20)); gc.setFont(new Font("Comic sans MS", 20));
gc.fillText("Hold x to interact with npc", x + 20, y + 50); gc.fillText("Hold x to interact with npc", x + 20, y + 50);
gc.restore(); gc.restore();
gc.setStroke(Color.WHITE);
gc.setLineWidth(5);
gc.strokeRoundRect(x, y, width, height, 35, 35);
} }
} }
...@@ -15,7 +15,7 @@ public class Player implements IGameObject{ ...@@ -15,7 +15,7 @@ public class Player implements IGameObject{
public int runCounter = 0; public int runCounter = 0;
public int invincibleTimer = 100; public int invincibleTimer = 100;
public int spawnX = 7000; //45 public int spawnX = 45;
public int spawnY = 50; public int spawnY = 50;
public boolean move_left = false; public boolean move_left = false;
......
...@@ -82,6 +82,10 @@ public class Waffle implements IGameObject { ...@@ -82,6 +82,10 @@ public class Waffle implements IGameObject {
gc.fillText("Hi! Waffle Thursday is closed and due\n to an error in the system, the very\n last waffle is made for " + gc.fillText("Hi! Waffle Thursday is closed and due\n to an error in the system, the very\n last waffle is made for " +
"two people,\n you and Anya!!! Battle against Anya\n to secure the last waffle.", x + 20, y + 50); "two people,\n you and Anya!!! Battle against Anya\n to secure the last waffle.", x + 20, y + 50);
gc.restore(); gc.restore();
gc.setStroke(Color.WHITE);
gc.setLineWidth(5);
gc.strokeRoundRect(x, y, width, height, 35, 35);
} }
public void waffleCount(GraphicsContext gc, Player player) { public void waffleCount(GraphicsContext gc, Player player) {
......
...@@ -501,7 +501,7 @@ public class Game extends Application { ...@@ -501,7 +501,7 @@ public class Game extends Application {
for (Checkpoint checkpoint : ListCheckpoint) { for (Checkpoint checkpoint : ListCheckpoint) {
checkpoint.drawCheckpoint(context, player); checkpoint.drawCheckpoint(context, player);
if (checkpoint.drawText) { if (checkpoint.drawText) {
checkpoint.drawCheckpointText(context); checkpoint.drawCheckpointText(context, this.width, this.height);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment