Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
final
final
  • Loading branch information
etl12003 committed May 1, 2015
1 parent 18789e7 commit f0adc69
Show file tree
Hide file tree
Showing 117 changed files with 1,714 additions and 0 deletions.
22 changes: 22 additions & 0 deletions LavaJava/.classpath
@@ -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>
24 changes: 24 additions & 0 deletions LavaJava/.project
@@ -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>
11 changes: 11 additions & 0 deletions LavaJava/.settings/org.eclipse.jdt.core.prefs
@@ -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 added LavaJava/bin/BoundingBox.class
Binary file not shown.
Binary file added LavaJava/bin/Button.class
Binary file not shown.
Binary file added LavaJava/bin/Game.class
Binary file not shown.
Binary file added LavaJava/bin/Grass.class
Binary file not shown.
Binary file added LavaJava/bin/Lava.class
Binary file not shown.
Binary file added LavaJava/bin/Level.class
Binary file not shown.
Binary file added LavaJava/bin/Level1.class
Binary file not shown.
Binary file added LavaJava/bin/Level2.class
Binary file not shown.
Binary file added LavaJava/bin/Level3.class
Binary file not shown.
Binary file added LavaJava/bin/LevelSelect.class
Binary file not shown.
Binary file added LavaJava/bin/LevelWon.class
Binary file not shown.
Binary file added LavaJava/bin/Map.class
Binary file not shown.
Binary file added LavaJava/bin/Player.class
Binary file not shown.
Binary file added LavaJava/bin/ScoreBox.class
Binary file not shown.
Binary file added LavaJava/bin/SwitchTile1.class
Binary file not shown.
Binary file added LavaJava/bin/SwitchTile2.class
Binary file not shown.
Binary file added LavaJava/bin/SwitchTile3.class
Binary file not shown.
Binary file added LavaJava/bin/SwitchTileRandom.class
Binary file not shown.
Binary file added LavaJava/bin/Tile.class
Binary file not shown.
Binary file added LavaJava/bin/Wall.class
Binary file not shown.
Binary file added LavaJava/bin/WinTile.class
Binary file not shown.
Binary file added LavaJava/bin/helpers/Artist.class
Binary file not shown.
Binary file added LavaJava/bin/res/Button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Character64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Character64_Left.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Character64_Right.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Character64_Up.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Died.wav
Binary file not shown.
Binary file added LavaJava/bin/res/Dirt64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/GameWon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Grass64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Lava64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/LavaJavaSplashScreen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Loading.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/LoadingBar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/MonsterA64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/MonsterB64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/MonsterC64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Player64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Snow64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Sound.wav
Binary file not shown.
Binary file added LavaJava/bin/res/Spawn64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Stone64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/Wall64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/bin/res/WinSound.wav
Binary file not shown.
Binary file added LavaJava/bin/res/footstep.wav
Binary file not shown.
Binary file added LavaJava/bin/res/levelSelectTemp.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LavaJava/natives/OpenAL32.dll
Binary file not shown.
Binary file added LavaJava/natives/OpenAL64.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-dx8.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-dx8_64.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-raw.dll
Binary file not shown.
Binary file added LavaJava/natives/jinput-raw_64.dll
Binary file not shown.
Binary file added LavaJava/natives/lwjgl.dll
Binary file not shown.
Binary file added LavaJava/natives/lwjgl64.dll
Binary file not shown.
93 changes: 93 additions & 0 deletions LavaJava/src/BoundingBox.java
@@ -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(){



}

}
54 changes: 54 additions & 0 deletions LavaJava/src/Button.java
@@ -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);
}
}
}
76 changes: 76 additions & 0 deletions LavaJava/src/Game.java
@@ -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;
}

}
64 changes: 64 additions & 0 deletions LavaJava/src/Grass.java
@@ -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;
}


}

0 comments on commit f0adc69

Please sign in to comment.