Skip to content

Commit

Permalink
Merge branch 'master' into robert
Browse files Browse the repository at this point in the history
  • Loading branch information
rvinluan committed Jul 28, 2011
2 parents 50ba845 + 35dab44 commit 25ef338
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 14 deletions.
8 changes: 2 additions & 6 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="lib/lwjgl.jar">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="GameTest/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/slick.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Users/rvinluan/Documents/slick/javadoc/"/>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="Zombies-Game/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/slick.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/bin/robertv/*
.DS_Store
*.log
hs_err*

1 change: 0 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
grdsgrdgrdgfwaf
Binary file added assets/mensch.ttf
Binary file not shown.
Binary file modified assets/terrain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/terrain.psd
Binary file not shown.
Binary file removed bin/robertv/GameTest/Book.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/Bookshelf.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/Entity.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/Map.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/Player.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/SimpleTest.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/Vector.class
Binary file not shown.
Binary file removed bin/robertv/GameTest/Zombie.class
Binary file not shown.
1 change: 1 addition & 0 deletions src/robertv/GameTest/Book.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public boolean collisionTrue(Entity collider, ArrayList<Entity> elist) {
if(collider instanceof Zombie) {
elist.remove(this);
elist.remove(collider);
SimpleTest.ZombiesKilled++;
return true;
}
if(collider instanceof Bookshelf) {
Expand Down
3 changes: 3 additions & 0 deletions src/robertv/GameTest/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ public Entity collisionCheck(ArrayList<? extends Entity> checklist) {


public boolean collisionTrue(Entity en, ArrayList<Entity> elist) {
if (en instanceof Player){
System.out.println("Player collision detected.");
}
return false;
}
}
19 changes: 18 additions & 1 deletion src/robertv/GameTest/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Player extends Entity {

//private Book[] inventory;
private int ammo;
private int health;

public Player(Map m) {
xCoord = 16;
Expand All @@ -39,6 +40,8 @@ public Player(Map m) {

ammo = 0;
//inventory = new Book[10];

health = 100;
}

public int setFacing(int direction) {
Expand Down Expand Up @@ -66,6 +69,10 @@ public int getAmmo() {
return ammo;
}

public int getHealth() {
return health;
}


///*
public void startMoving(int direction) {
Expand Down Expand Up @@ -170,6 +177,7 @@ public void update() {
}

public Entity collisionCheck(ArrayList<? extends Entity> checklist) {

Rectangle oldaabb = new Rectangle(0,0,0,0);
oldaabb.setBounds(aabb);
aabb.setBounds(aabb.getX()+(float)velocity.x, aabb.getY()-(float)velocity.y, aabb.getWidth(), aabb.getHeight());
Expand Down Expand Up @@ -220,5 +228,14 @@ public void render(int xp, int yp) {
}
}


@Override
public boolean collisionTrue(Entity en, ArrayList<Entity> elist) {
if (en instanceof Zombie){
health = health - 10;
System.out.println("Collision with zombie detected!");
return true;
}
System.out.println("player collision true reached!");
return false;
}
}
34 changes: 28 additions & 6 deletions src/robertv/GameTest/SimpleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

import java.util.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontFormatException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
Expand Down Expand Up @@ -42,16 +47,21 @@ public class SimpleTest extends BasicGame {

UnicodeFont ufont; //for printing info to the GUI

UnicodeFont uFont2; // For messages

Input keyboard;

/*
* Scoring Variables
*/
int maxHeight;
public static int ZombiesKilled;
private final int SCORE_VAR_HEIGHT = 672-(4*32)+3;

public SimpleTest() {
super("SimpleTest");
super("Zombies Game. SHOVE THIS BOOK UP YOUR ASS MUTHAFUCKA!!!!!111");
frame = 0;
ZombiesKilled = 0;
}

@Override
Expand All @@ -76,11 +86,17 @@ public void init(GameContainer container) throws SlickException {
/*
* for getting the GUI info to display
*/
ufont = new UnicodeFont("/assets/Menlo.ttc", 20, false, false);
ufont = new UnicodeFont("/assets/mensch.ttf", 22, false, false);
ufont.getEffects().add(new ColorEffect(java.awt.Color.BLACK));
ufont.addGlyphs("0123456789");
ufont.loadGlyphs();

//For custom message test
uFont2 = new UnicodeFont("/assets/mensch.ttf", 22, false, false);
uFont2.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
uFont2.addGlyphs("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.'!");
uFont2.loadGlyphs();


/*
* set up the sprites
Expand Down Expand Up @@ -126,7 +142,9 @@ public void update(GameContainer container, int delta)
}
}

///*
/**
* This method captures key presses from the keyboard
*/
@Override
public void keyPressed(int key, char c) {
switch (key) {
Expand All @@ -138,12 +156,14 @@ public void keyPressed(int key, char c) {
break;
case Input.KEY_RIGHT : rachel.startMoving(Player.WEST);
break;
// 'A' key used for taking a book
case Input.KEY_A :
Bookshelf check = gameSpace.getSpecificShelf(rachel.xCoord - 1, rachel.yCoord, 0, 1);
if(rachel.isFacing(Player.NORTH) && (check != null)) {
rachel.takeBook(check);
}
break;
// 'S' key used for throwing book
case Input.KEY_S :
rachel.fireBook(entities);
}
Expand Down Expand Up @@ -245,10 +265,12 @@ public void render(GameContainer container, Graphics g)
rachel.render(480, 336);

GUI.draw(0,672-(32*5));
ufont.drawString(96+30, 672-(4*32)+5, ""+rachel.getAmmo());
ufont.drawString((32*12)+30, 672-(4*32)+5, ""+ maxHeight);
ufont.drawString(96+21, SCORE_VAR_HEIGHT, "" + rachel.getAmmo());
ufont.drawString(96+101, SCORE_VAR_HEIGHT, "" + ZombiesKilled);
ufont.drawString(96+180, SCORE_VAR_HEIGHT, "" + rachel.getHealth());
ufont.drawString((32*12)+30, SCORE_VAR_HEIGHT, "" + maxHeight);
uFont2.drawString(500, SCORE_VAR_HEIGHT, "Don't get hit.");


//check collisions
for(Entity e : entities) {
ArrayList<Bookshelf> colliders = gameSpace.getSurroundingShelves(e.yCoord, e.xCoord);
Expand Down

0 comments on commit 25ef338

Please sign in to comment.