Skip to content
Snippets Groups Projects
Unverified Commit 7175e396 authored by Oscar Wiberg's avatar Oscar Wiberg Committed by GitHub
Browse files

Merge pull request #2 from Oscarwib/newmode

Newmode
parents 1f445935 160a139f
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 27 deletions
49
\ No newline at end of file
158
\ No newline at end of file
src/Images1/8ball.png

10.4 KiB

src/Images1/bomb.png

25.7 KiB

src/Images1/car.png

55.2 KiB

src/Images1/cloud.png

3.03 KiB

src/Images1/dinosaur.png

115 KiB

src/Images1/fire_engine.png

27.2 KiB

src/Images1/fly.png

72.2 KiB

src/Images1/h-banana.png

33.2 KiB

src/Images1/heart.png

886 B

src/Images1/helicopter.png

22 KiB

src/Images1/player2_sliding.png

99 KiB

src/Images1/player_sliding.png

124 KiB

src/Images1/runner.png

18.5 KiB

src/Images1/smiley.png

37.5 KiB

src/Images1/tree.png

5.11 KiB

src/Images1/woman-running.png

19.4 KiB

package constants;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javafx.scene.image.Image;
/**
* @author oscarwiberg, filipyhde
* Definerar globala konstanter som vi använder återkommande i andra klasser.
*/
public interface Constants {
/**
* In this file we define some global constants.
*
* An interface is one way to store variables that are truly constants and not
* subject to change during run time.
*
* Please note that the problem with global variables is that anyone can change
* them whenever. This makes it extremely hard to reason about your code. But
* for constants, this is not a problem since we cannot change them, and
* therefore they stay the same during the entire execution of the program.
*/
/*
* Define the size of the window
*/
final int screenWidth = 1000;
final int screenHeight = 500;
......@@ -40,12 +25,21 @@ public interface Constants {
//enemies
String enemyImg = "src/Images1/lorry.png";
String enemyImg2 = "src/Images1/fire_engine.png";
String flyingEnemyImg = "src/Images1/saucer.png";
double enemyWidth = 100;
double enemyHeight = 100;
String flyingEnemyImg2 = "src/Images1/helicopter.png";
String bombImg = "src/Images1/bomb.png";
String bombImg2 = "src/Images1/8ball.png";
double bombWidth = 50;
double bombHeight = 50;
double enemyWidth = 80;
double enemyHeight = 80;
// powerups
String lifeImg = "src/Images1/heart2.png";
String powerImge = "src/Images1/blixt.png";
String lifeImg = "src/Images1/apple.png";
String powerImg = "src/Images1/zap.png";
double powerWidth = 40;
double powerHeight = 40;
}
package main;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import states.GameModel;
/**
* @author oscarwiberg, filipyhde
* This class Wraps a HBox: A HBox is a second level JavaFX container used
* organize contents in the window (Stage/Scene).
*
* The GameFrame, in this case, has the job of creating the game panel, and
* adding it to itself in order for it to show.
*
*/
public class GameFrame extends HBox {
private GamePanel g;
......
package main;
import states.GameModel;
import javafx.scene.canvas.Canvas;
/**
* @author oscarwiberg, filipyhde
* The GamePanel wraps a Canvas
*
* The main responsibilities of the GamePanel are:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment