-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started on a selection gui Updated collision to handle potential "sinking" with left, right, and top collision. Enabled player to "use" a potion
- Loading branch information
Mark Diez
committed
Aug 11, 2015
1 parent
ea401e9
commit 79779c6
Showing
13 changed files
with
623 additions
and
93 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+0 Bytes
(100%)
out/production/Projects/net/codelets/javaplatformer/GamePanel.class
Binary file not shown.
Binary file modified
BIN
+850 Bytes
(120%)
out/production/Projects/net/codelets/javaplatformer/entities/Player.class
Binary file not shown.
Binary file modified
BIN
+1.32 KB
(210%)
out/production/Projects/net/codelets/javaplatformer/gui/InventoryGUI.class
Binary file not shown.
Binary file modified
BIN
-298 Bytes
(84%)
out/production/Projects/net/codelets/javaplatformer/gui/StatusGUI.class
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
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
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,44 @@ | ||
package net.codelets.javaplatformer.gui; | ||
|
||
import net.codelets.javaplatformer.GamePanel; | ||
|
||
import java.awt.*; | ||
import java.awt.event.KeyEvent; | ||
|
||
/** | ||
* Created by Mark on 8/11/2015. | ||
*/ | ||
public class SelectionGUI { | ||
private int posX; | ||
private int posY; | ||
private int width; | ||
private int height; | ||
private String[] choices; | ||
|
||
public SelectionGUI(String[] choices, int width, int height) { | ||
this.posX = GamePanel.WIDTH / 2; | ||
this.posY = GamePanel.HEIGHT / 2; | ||
this.width = width; | ||
this.height = height; | ||
this.choices = choices; | ||
} | ||
|
||
public void update() { | ||
|
||
} | ||
|
||
public void draw(Graphics g) { | ||
|
||
} | ||
|
||
public void keyPressed(int key) { | ||
switch(key) { | ||
case KeyEvent.VK_UP: | ||
break; | ||
case KeyEvent.VK_DOWN: | ||
break; | ||
case KeyEvent.VK_ENTER: | ||
break; | ||
} | ||
} | ||
} |
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
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,51 @@ | ||
package net.codelets.javaplatformer.items; | ||
|
||
/** | ||
* Created by Mark on 8/11/2015. | ||
*/ | ||
public class Bag extends Item{ | ||
private Item[] items; | ||
private int maxLoad; | ||
private int currentLoad; | ||
|
||
public Bag() { | ||
super(); | ||
this.maxLoad = 5; | ||
this.currentLoad = 0; | ||
this.items = new Item[maxLoad]; | ||
} | ||
|
||
public Bag(String name, String description, int maxLoad) { | ||
super(name, description); | ||
this.maxLoad = maxLoad; | ||
this.currentLoad = 0; | ||
this.items = new Item[maxLoad]; | ||
} | ||
|
||
public void add(Item newItem) { | ||
if(currentLoad < maxLoad) { | ||
this.items[currentLoad] = newItem; | ||
currentLoad++; | ||
} else { | ||
System.out.println("Inventory Full"); | ||
} | ||
} | ||
|
||
public void remove(int index) { | ||
this.items[index] = null; | ||
// Shifts the items | ||
for(int i = index; i < currentLoad; i++) { | ||
this.items[i] = this.items[i+1]; | ||
} | ||
currentLoad--; | ||
} | ||
|
||
public Item get(int index) { | ||
return this.items[index]; | ||
} | ||
|
||
// Getters & Setters | ||
public Item[] getItems() { return this.items; } | ||
public int getCurrentLoad() { return this.currentLoad; } | ||
public int getMaxLoad() { return this.maxLoad; } | ||
} |
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 @@ | ||
package net.codelets.javaplatformer.items; | ||
|
||
/** | ||
* Created by Mark on 8/11/2015. | ||
*/ | ||
public abstract class Item { | ||
private String name; | ||
private String description; | ||
|
||
public Item() { | ||
this.name = "Unknown"; | ||
this.description = "N/A"; | ||
} | ||
|
||
public Item(String name, String description) { | ||
this.name = name; | ||
this.description = description; | ||
} | ||
|
||
public String inspect() { | ||
return getName() + ", " + getDescription(); | ||
} | ||
|
||
// getters & setters | ||
public String getName() { return this.name; } | ||
public String getDescription() { return this.description; } | ||
} |
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 @@ | ||
package net.codelets.javaplatformer.items; | ||
|
||
/** | ||
* Created by Mark on 8/11/2015. | ||
*/ | ||
public class Potion extends Item { | ||
private int value; | ||
|
||
public Potion() { | ||
super("Unidentified Potion", "Drink if you dare"); | ||
this.value = 100; | ||
} | ||
|
||
public Potion(String name, String description, int value) { | ||
super(name, description); | ||
this.value = value; | ||
} | ||
|
||
|
||
// Setters & Getters | ||
public int getValue() { return value; } | ||
} |
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 @@ | ||
package net.codelets.javaplatformer.items; | ||
|
||
/** | ||
* Created by Mark on 8/11/2015. | ||
*/ | ||
public class Weapon extends Item { | ||
private int attackMax; | ||
private int attackMin; | ||
|
||
public Weapon() { | ||
super("Unidentified Weapon", "It doesn't look cursed..."); | ||
this.attackMax = 2; | ||
this.attackMin = 1; | ||
} | ||
|
||
public Weapon(String name, String description, int attackMax, int attackMin) { | ||
super(name, description); | ||
this.attackMin = attackMin; | ||
this.attackMax = attackMax; | ||
} | ||
|
||
} |