Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
final
final
- Loading branch information
Showing
117 changed files
with
1,714 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"> | ||
<attributes> | ||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="C:/Users/Dan/Desktop/natives"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="natives"> | ||
<attributes> | ||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="C:/Users/Dan/Desktop/natives"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> | ||
<classpathentry kind="lib" path="C:/Users/Erik/git/lavaJava2/LavaJava/LavaJava/jars/lwjgl.jar"> | ||
<attributes> | ||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="C:/Users/Erik/Desktop/LavaFinal/LavaFinal/natives"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="lib" path="C:/Users/Erik/git/lavaJava2/LavaJava/LavaJava/jars/lwjgl_util.jar"/> | ||
<classpathentry kind="lib" path="C:/Users/Erik/git/lavaJava2/LavaJava/LavaJava/jars/slick-util.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>LavaJava</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
<linkedResources> | ||
<link> | ||
<name>natives</name> | ||
<type>2</type> | ||
<location>C:/Users/Dan/Desktop/natives</location> | ||
</link> | ||
</linkedResources> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import java.awt.Point; | ||
|
||
import org.lwjgl.input.Keyboard; | ||
|
||
|
||
public class BoundingBox { | ||
private double x1, y1; // lower left | ||
private double x2, y2; // upper right | ||
|
||
public BoundingBox(double x1, double y1, double x2, double y2) { | ||
this.x1 = Math.min(x1, x2); | ||
this.x2 = Math.max(x1, x2); | ||
this.y1 = Math.min(y1, y2); | ||
this.y2 = Math.max(y1, y2); | ||
} | ||
|
||
public BoundingBox(Point p, Point q) { | ||
this(p.x, p.y, q.x, q.y); | ||
} | ||
|
||
// random rectangle in unit square | ||
public BoundingBox() { | ||
this(new Point(), new Point()); | ||
} | ||
|
||
// is Point p inside this BoundingBox? | ||
public boolean contains(Point p) { | ||
return (p.x >= x1 && p.x <= x2 && p.y >= y1 && p.y <= y2); | ||
} | ||
|
||
// does this BoundingBox r intersect s? | ||
public boolean intersects(BoundingBox s) { | ||
boolean collision = false; | ||
|
||
BoundingBox r = this; | ||
double x1past = r.x1; | ||
double x2past = r.x2; | ||
double y1past = r.y1; | ||
double y2past = r.y2; | ||
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { | ||
r.x1 += -4; | ||
r.x2 += -4; | ||
} | ||
if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)){ | ||
r.x1 += 4; | ||
r.x2 += 4; | ||
|
||
} | ||
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { | ||
r.y1 += -4; | ||
r.y2 += -4; | ||
|
||
} | ||
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { | ||
r.y1 += 4; | ||
r.y2 += 4; | ||
|
||
} | ||
if (r.x2 >= s.x1 && r.y2 >= s.y1 && s.x2 >= r.x1 && s.y2 >= r.y1) { | ||
collision = true; | ||
} | ||
r.x1 = x1past; | ||
r.x2 = x2past; | ||
r.y1 = y1past; | ||
r.y2 = y2past; | ||
return (collision); | ||
} | ||
|
||
|
||
// return the area | ||
public double area() { | ||
return (x2 - x1) * (y2 - y1); | ||
} | ||
|
||
// return the area | ||
public String toString() { | ||
return "[(" + x1 + ", " + y1 + ") (" + x2 + ", " + y2 + ")]"; | ||
} | ||
public void setBoundingBox(double x1, double y1, double x2, double y2){ | ||
this.x1 = Math.min(x1, x2); | ||
this.x2 = Math.max(x1, x2); | ||
this.y1 = Math.min(y1, y2); | ||
this.y2 = Math.max(y1, y2); | ||
} | ||
|
||
|
||
public void move(){ | ||
|
||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import java.awt.Font; | ||
|
||
import org.lwjgl.input.Mouse; | ||
import org.lwjgl.opengl.Display; | ||
import org.newdawn.slick.Color; | ||
import org.newdawn.slick.TrueTypeFont; | ||
import org.newdawn.slick.opengl.Texture; | ||
|
||
import static helpers.Artist.DrawQuadTex; | ||
import static helpers.Artist.QuickLoadTexture; | ||
|
||
public class Button extends BoundingBox { | ||
private final int BOX_DIM = 32; | ||
Texture tex; | ||
BoundingBox clickBox; | ||
BoundingBox mouse; | ||
private int x,y; | ||
private int levelStatetoSet; | ||
TrueTypeFont font; | ||
String label; | ||
|
||
public Button(int x, int y, int levelStatetoSet,String buttonLabel) { | ||
label = buttonLabel; | ||
this.levelStatetoSet = levelStatetoSet; | ||
this.x = x; | ||
this.y = y; | ||
clickBox = new BoundingBox(); | ||
mouse = new BoundingBox(); | ||
clickBox.setBoundingBox(x, y, x+BOX_DIM, y+BOX_DIM); | ||
mouse.setBoundingBox(x, y, x+BOX_DIM, y+BOX_DIM); | ||
|
||
} | ||
|
||
public void init(){ | ||
Font awtFont = new Font("Comic Sans MS", Font.BOLD, 20); | ||
font = new TrueTypeFont(awtFont, false); | ||
|
||
tex = QuickLoadTexture("Button"); | ||
|
||
} | ||
public void render(){ | ||
DrawQuadTex(tex, x, y, BOX_DIM, BOX_DIM); | ||
font.drawString(x+10, y,label, Color.white); | ||
mouse.setBoundingBox(Mouse.getX(),Display.getHeight()- Mouse.getY(),Mouse.getX()+10, Display.getHeight()-Mouse.getY()); | ||
checkClick(); | ||
|
||
} | ||
public void checkClick(){ | ||
if (mouse.intersects(clickBox)&& Mouse.isButtonDown(0)) { | ||
//System.out.println("YOU CLICKED THE BOX!!!!"); | ||
Game.setLevelState(levelStatetoSet); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import static helpers.Artist.SetUp; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
import org.lwjgl.openal.AL; | ||
import org.lwjgl.opengl.Display; | ||
import org.lwjgl.opengl.GL11; | ||
import org.newdawn.slick.openal.Audio; | ||
import org.newdawn.slick.openal.AudioLoader; | ||
import org.newdawn.slick.opengl.Texture; | ||
import org.newdawn.slick.util.ResourceLoader; | ||
|
||
import static helpers.Artist.DrawQuadTex; | ||
import static helpers.Artist.QuickLoadTexture; | ||
|
||
public class Game { | ||
|
||
public static int levelState = 0; | ||
public static Audio music; | ||
public static void main(String[] args) throws IOException { | ||
SetUp(768, 768); | ||
Level currentLevel; | ||
Texture loading = QuickLoadTexture("Loading"); | ||
Texture bar = QuickLoadTexture("LoadingBar"); | ||
ArrayList<Level> levelArray = new ArrayList<Level>(); | ||
LevelSelect l0 = new LevelSelect(); | ||
Level1 l1 = new Level1(); | ||
Level2 l2 = new Level2(); | ||
Level3 l3 = new Level3(); | ||
LevelWon LW = new LevelWon(); | ||
levelArray.add(l0); | ||
levelArray.add(l1); | ||
levelArray.add(l2); | ||
levelArray.add(l3); | ||
levelArray.add(LW); | ||
//Loading Screen while assets load in; | ||
for (int i = 0; i < levelArray.size(); i++) { | ||
Display.setTitle("LavaJava"); | ||
Display.sync(60); | ||
DrawQuadTex(loading, 0, 0, 1100, 1100); | ||
DrawQuadTex(bar, 225, 378, 83*i, 36);//Magical numbers | ||
Display.update(); | ||
levelArray.get(i).init();//Load Assets for each level | ||
} | ||
//Done Loading | ||
|
||
music = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("res/Sound.wav")); | ||
music.playAsMusic(1.0f, 1.0f, true); | ||
//initialize outside of the loop or else this shit gets really slow | ||
while(!Display.isCloseRequested()){ | ||
Display.setTitle("LavaJava"); | ||
Display.sync(60); | ||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); | ||
|
||
//Check collisions before you move or the player gets his ass lodged in a wall for eternity | ||
currentLevel = levelArray.get(levelState); | ||
currentLevel.render(); | ||
//System.out.println(levelState); | ||
|
||
|
||
Display.update(); | ||
} | ||
Display.destroy(); | ||
AL.destroy(); | ||
} | ||
|
||
public static void setLevelState(int newState){ | ||
Game.levelState = newState; | ||
|
||
} | ||
public int getState(){ | ||
return levelState; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import org.newdawn.slick.opengl.Texture; | ||
import static helpers.Artist.DrawQuadTex; | ||
import static helpers.Artist.QuickLoadTexture; | ||
|
||
public class Grass extends BoundingBox implements Tile { | ||
private final boolean collidable = false; | ||
private final int TILEID = 2; | ||
private static int TILE_DIM = 64; | ||
private int x,y; | ||
private BoundingBox hitBox; | ||
Texture tex; | ||
private final boolean canKillPlayer = false; | ||
|
||
public Grass(int x,int y){ | ||
hitBox = new BoundingBox(x,y,x+ TILE_DIM,y + TILE_DIM); | ||
this.x = x; | ||
this.y = y; | ||
|
||
} | ||
|
||
public void init(){ | ||
tex = QuickLoadTexture("Grass64"); | ||
} | ||
public void render(){ | ||
DrawQuadTex(tex, x, y, TILE_DIM, TILE_DIM); | ||
|
||
} | ||
public int x1(){ | ||
return x; | ||
} | ||
public int x2(){ | ||
return x + TILE_DIM; | ||
} | ||
public int y1(){ | ||
return y; | ||
} | ||
public int y2(){ | ||
return y+TILE_DIM; | ||
} | ||
|
||
public int getTILEID() { | ||
return TILEID; | ||
} | ||
|
||
public boolean isCollidable() { | ||
return collidable; | ||
} | ||
|
||
public BoundingBox getBoundingBox() { | ||
return hitBox; | ||
} | ||
|
||
public boolean isCanKillPlayer() { | ||
return canKillPlayer; | ||
} | ||
|
||
@Override | ||
public boolean isWin() { | ||
// TODO Auto-generated method stub | ||
return false; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.