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
First
Dan's changes
- Loading branch information
0 parents
commit 9b8f678
Showing
37 changed files
with
530 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,17 @@ | ||
<?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 DeMarco/Desktop/lib/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/Desktop/Desktop/lib/jars/lwjgl.jar"/> | ||
<classpathentry kind="lib" path="C:/Users/Erik/Desktop/Desktop/lib/jars/lwjgl_util.jar"> | ||
<attributes> | ||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="C:/Users/Erik/Desktop/the game/fwd2102game417/LavaJava/LavaJava/natives"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="lib" path="C:/Users/Erik/Desktop/Desktop/lib/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,17 @@ | ||
<?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> | ||
</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 |
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,10 @@ | ||
/BoundingBox.class | ||
/ColidableObject.class | ||
/Game.class | ||
/GameStateManager.class | ||
/Level1.class | ||
/ObjectArray.class | ||
/Player.class | ||
/Wall.class | ||
/helpers/ | ||
/res/ |
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,53 @@ | ||
import java.awt.Point; | ||
|
||
|
||
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) { | ||
BoundingBox r = this; | ||
return (r.x2 >= s.x1 && r.y2 >= s.y1 && s.x2 >= r.x1 && s.y2 >= r.y1); | ||
} | ||
|
||
|
||
// 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); | ||
} | ||
|
||
|
||
} |
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,27 @@ | ||
|
||
public abstract class ColidableObject { | ||
|
||
public void init(){ | ||
|
||
} | ||
public void render(){ | ||
|
||
} | ||
public int x1(){ | ||
return 0; | ||
|
||
} | ||
public int x2(){ | ||
return 0; | ||
} | ||
public int y1(){ | ||
return 0; | ||
|
||
} | ||
public int y2(){ | ||
return 0; | ||
} | ||
|
||
|
||
|
||
} |
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,31 @@ | ||
import static helpers.Artist.SetUp; | ||
|
||
import java.util.ArrayList; | ||
|
||
import org.lwjgl.input.Mouse; | ||
import org.lwjgl.opengl.Display; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
|
||
public class Game { | ||
|
||
public static void main(String[] args) { | ||
|
||
SetUp(800, 600); | ||
Level1 m = new Level1(); | ||
|
||
while(!Display.isCloseRequested()){ | ||
Display.setTitle("Bounding"); | ||
Display.update(); | ||
Display.sync(60); | ||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); | ||
m.render(); | ||
|
||
|
||
|
||
|
||
} | ||
Display.destroy(); | ||
} | ||
|
||
} |
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,18 @@ | ||
import java.util.ArrayList; | ||
|
||
|
||
public class GameStateManager { | ||
private int currentState; | ||
private ArrayList<GameState> states; | ||
public static final int MENUSTATE = 0; | ||
|
||
// add more state integers here | ||
|
||
public GameStateManager() { | ||
states = new ArrayList<GameState>(); | ||
states.add(new MenuState()); | ||
|
||
} | ||
|
||
|
||
} |
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,59 @@ | ||
import org.lwjgl.input.Mouse; | ||
import org.newdawn.slick.opengl.Texture; | ||
import static helpers.Artist.DrawQuadTex; | ||
|
||
import static helpers.Artist.QuickLoadTexture; | ||
|
||
public class Level1 { | ||
Texture Background,blockers; | ||
private String grass = "Grass64"; | ||
private String dirt = "Dirt64"; | ||
Player player = new Player(400,300); | ||
ObjectArray w = new ObjectArray(); | ||
Wall w1 = new Wall(400,400); | ||
ColidableObject x = new Wall(0, 0); | ||
|
||
public Level1() { | ||
init(); | ||
} | ||
void init(){ | ||
Background = QuickLoadTexture(grass); | ||
blockers = QuickLoadTexture(dirt); | ||
|
||
} | ||
void render(){ | ||
for (int i = 0; i < 800; i+= 64) { | ||
for (int j = 0; j < 600; j+=64) { | ||
DrawQuadTex(Background,i,j,64,64); | ||
DrawQuadTex(blockers, 0, j, 64, 64); | ||
} | ||
|
||
} | ||
|
||
for (int i = 0; i<w.size()-1; i++) { | ||
w.getWall(i).render(); | ||
|
||
} | ||
|
||
player.checkCollsionAndMove((Wall) w.getWall(0)); | ||
player.update(); | ||
player.render(); | ||
System.out.println(player.getMotionX() + " " + player.getMotionY()); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
} |
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,26 @@ | ||
import java.util.ArrayList; | ||
|
||
|
||
public class ObjectArray { | ||
ArrayList<ColidableObject> lvl1 = new ArrayList<ColidableObject>(); | ||
static int increment = 10; | ||
|
||
public ObjectArray() { | ||
for (int i = 0; i < 5; i++) { | ||
lvl1.add(new Wall(200,increment)); | ||
increment+=64; | ||
} | ||
} | ||
|
||
public int size(){ | ||
return lvl1.size(); | ||
|
||
} | ||
public ColidableObject getWall(int i){ | ||
return lvl1.get(i); | ||
} | ||
public ArrayList<ColidableObject> returnList(){ | ||
return lvl1; | ||
} | ||
|
||
} |
Oops, something went wrong.