Skip to content

Commit

Permalink
Basic Tower Sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
ssl10003 committed Apr 17, 2015
1 parent a957302 commit 31c248e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/StatGui.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import javax.swing.JLabel;
import javax.swing.JPanel;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.imageio.ImageIO;
import javax.swing.*;



public class StatGui extends JPanel {

public class StatGui extends JPanel implements ActionListener{
private int X, Y;
private MapTowerDefense map;
private int maxHealth = 20;
private int playermoney = 1000;
JLabel hpLabel, moneyLabel, towersnumLabel;
JButton AOEbutton, BasicTowerbutton;

public StatGui (int x, int y) {
X = x;
Expand Down Expand Up @@ -61,6 +69,21 @@ public void setup(){
towersnumLabel.setForeground(Color.BLUE);
this.add(towersnumLabel);

ImageIcon AOEicon = new ImageIcon("src/resources/images/AOE Tower.png", "AOE tower sprite");
AOEbutton = new JButton("AOE Tower", AOEicon);
AOEbutton.setActionCommand("select aoe tower");
AOEbutton.setEnabled(true);
AOEbutton.addActionListener(this);
this.add(AOEbutton);

}

public void actionPerformed(ActionEvent e){
if("select aoe tower".equals(e.getActionCommand())){
AOEbutton.setEnabled(true);
//set tower placer variable to place aoe tower
System.out.println("AOE tower selected!");
}
}

public void updateHealth(){
Expand Down
Binary file added src/resources/images/Basic Tower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31c248e

Please sign in to comment.