Permalink
Browse files

Merge branch 'master' of github.com:byang223/TurnBAPI

  • Loading branch information...
2 parents 4d146ab + 6f79ac4 commit 2585ea9d669933ac8e4cd815653a62c0e74641b3 @andrewkshim andrewkshim committed Apr 27, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -43,7 +43,7 @@ public void render(Graphics2D g) {
int i = 0;
for(ButtonSprite temp: buttons){
newgroup.add(temp);
- temp.setLocation(500, 100*i);
+ temp.setLocation(xLoc, 100*i + yLoc);
temp.render(g);
i++;
@@ -3,12 +3,12 @@
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
-import modes.Selections;
+import modes.selections.Selections;
import modes.models.GameModel;
import units.Unit;
-import units.attributes.AttributeHealth;
+import attribute.AttributeHealth;
public class UnitDisplay extends Display{
View
@@ -204,8 +204,8 @@ public void unhighlightRange(int tileRank) {
public void unHighlightEverything(){
Tile[][] tiles = this.getTiles();
- for (int r = 0; r < this.getHeight(); ++r) {
- for (int c = 0; c < this.getWidth(); ++c) {
+ for (int r = 0; r < this.getDimY(); ++r) {
+ for (int c = 0; c < this.getDimX(); ++c) {
tiles[r][c].clearSelection();
}
}
View
@@ -1,13 +1,5 @@
package modes;
-import environment.Environment;
-import environment.Mountain;
-import environment.PoisonGas;
-import environment.Snow;
-import frame.TBPanel;
-import frame.display.CommandDisplay;
-import frame.layout.BorderLayout;
-import frame.layout.TopDownLayout;
import input.InputEngine;
import java.awt.Color;
@@ -26,6 +18,7 @@
import modes.models.StandbyModel;
import modes.models.WaitingModel;
import player.Player;
+import units.HewnerUnit;
import units.PikachuFactoryUnit;
import units.PikachuUnit;
import units.Unit;
@@ -42,13 +35,21 @@
import com.golden.gamedev.GameEngine;
import com.golden.gamedev.object.PlayField;
import com.golden.gamedev.object.SpriteGroup;
-import com.golden.gamedev.object.background.ColorBackground;
-import com.golden.gamedev.object.background.ImageBackground;
+
+import environment.Environment;
+import environment.Mountain;
+import environment.PoisonGas;
+import environment.Snow;
+import frame.TBPanel;
+import frame.display.CommandDisplay;
+import frame.display.Display;
+import frame.layout.BorderLayout;
public class GameMode extends TBGameMode {
//for testing
TBPanel gameFrame;
+ Display d;
public GameMode(GameEngine arg0) {
super(arg0);
@@ -116,14 +117,16 @@ public void initResources() {
BufferedImage s;
try {
s = ImageIO.read(new File("resources/TBBackgrounds/WHITE.jpg"));
- setDisplay(new CommandDisplay(s, 500, 0));
+ d = new CommandDisplay(s, 500, 0);
} catch (IOException e) {
e.printStackTrace();
}
- //gameFrame.setLayout(new BorderLayout());
+ gameFrame.setLayout(new BorderLayout());
+
+ gameFrame.add(getMap(), "LEFT");
+ gameFrame.add(d, "RIGHT");
- //gameFrame.add(getMap(), "LEFT");
System.out.println("STATE");
@@ -238,13 +241,17 @@ public void defaultInitialization() {
Unit pika8 = new PikachuUnit();
Unit pika9 = new PikachuUnit();
Unit pika10 = new PikachuUnit();
+ Unit hewner = new HewnerUnit();
getMap().getTileByCoords(6, 7).setUnit(pika6);
getMap().getTileByCoords(6, 6).setUnit(pika7);
getMap().getTileByCoords(5, 6).setUnit(pika8);
getMap().getTileByCoords(7, 7).setUnit(pika9);
getMap().getTileByCoords(7, 6).setUnit(pika10);
+ getMap().getTileByCoords(0, 0).setUnit(hewner);
+ addUnit.changeUnit(hewner);
+ addUnit.modify();
addUnit2.changeUnit(pika6);
addUnit2.modify();
addUnit2.changeUnit(pika7);
@@ -262,14 +269,16 @@ public void defaultInitialization() {
addUnit.changeUnit(pikaFact);
addUnit.modify();
+
}
public void render(Graphics2D g) {
refresh(g);
//getPlayfield().render(g);
- getMap().render(g);
- getDisplay().render(g);
- //gameFrame.render(g);
+ //getMap().render(g);
+ //getDisplay().render(g);
+
+ gameFrame.render(g);
}
private void refresh(Graphics2D g) {
@@ -35,7 +35,6 @@
private static Background tileBackground;
private int xDim;
private int yDim;
- private Display d;
private long playTime;
private HashMap<Integer, GameModel> modelMap;
private SpriteGroup environmentGroup;
@@ -143,14 +142,6 @@ public GameFont getFont() {
return font;
}
- public void setDisplay(Display d) {
- this.d = d;
- }
-
- public Display getDisplay() {
- return d;
- }
-
public void setPlayerList(ArrayList<Player> playerList) {
this.playerList = playerList;
}
View
@@ -0,0 +1,48 @@
+package units;
+
+import units.interactions.UnitButtonAttack;
+import units.interactions.UnitButtonMove;
+import units.interactions.UnitButtonNova;
+import attribute.AchievementList;
+import attribute.AttributeAttack;
+import attribute.AttributeExperience;
+import attribute.AttributeHealth;
+import attribute.AttributeImage;
+import attribute.AttributeKills;
+import attribute.AttributeLevel;
+import attribute.AttributeMove;
+import attribute.AttributeReactable;
+
+public class HewnerUnit extends Unit{
+ public HewnerUnit(){
+ attributeList.add(new AttributeMove(this, 8));
+ attributeList.add(new AttributeAttack(this, 20, 6, 1));
+ attributeList.add(new AttributeHealth(this, 1000));
+ attributeList.add(new AttributeLevel(this));
+ attributeList.add(new AttributeExperience(this));
+ attributeList.add(new AttributeReactable(this));
+
+ attributeList.add(new AchievementList(this));
+ attributeList.add(new AttributeKills(this));
+ attributeList.add(new AttributeImage(this,imageFilepath()));
+ interactionList.add(new UnitButtonMove());
+ interactionList.add(new UnitButtonAttack());
+ interactionList.add(new UnitButtonNova());
+ }
+ @Override
+ public String unitName() {
+ return "Mike Hewner";
+ }
+
+ @Override
+ public String imageFilepath() {
+ return "resources/unit images/hewner.png";
+ }
+
+ @Override
+ public String addButton() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}

0 comments on commit 2585ea9

Please sign in to comment.