Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into Stat-Gui
Browse files Browse the repository at this point in the history
  • Loading branch information
ssl10003 committed Apr 26, 2015
2 parents 3b17dc2 + 4590234 commit 4afbb76
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sourceforge.metrics.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sourceforge.metrics.nature</nature>
</natures>
</projectDescription>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TowerDefense
============

Play the most exiting thing since sliced bread! Introducing the best Tower Defense gamed you've ever played. Does your tower defense game have characteres such as Sonic, the Depsicable Me minion, and a Speedy Gonzalez? I didn't think so. Does it have some of the best tower models rendered from industry-level computer graphics, that is java.awt.swing? Nope. Well try your hand today and use some of the best tower-power available. See if you can overcome the hordes of minions itching to knock down your Nexus!

From the creative talents of CSE 2102 students
Mock Tower Defense Game (R) All Rights Reserved.
Unauthorized Duplication Is A Violation Of Applicable Laws and punishable with at least 1 hour of playing this game.

8 changes: 8 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import java.awt.*;

import javax.swing.*;

public class Main extends JFrame{
Expand Down Expand Up @@ -29,6 +30,13 @@ public static void main(String[] args) {
frame.setSize(860,670);
frame.setVisible(true);

map.createMinion(MinionTypes.BASIC);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
map.createMinion(MinionTypes.BASIC);
mg.step();
}
Expand Down
4 changes: 2 additions & 2 deletions src/MockGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void drawBasicAttack(int x, int y, Graphics g){

//if Basic tower is attacking, draw dots to where minion is
public void drawAllBasicAttacks(TowerFactory TF, Graphics g){
for(int i = 0; i < TF.getNum(); i++){
for(int i = 1; i < TF.getNum(); i++){
if(TF.getTowerArray()[i].basicDealDamage() && TF.getTowerArray()[i].type == TowerTypes.BASIC){
int towerDotX = (TF.getTowerArray()[i]._xlocation * 32) + 15;
int towerDotY = (TF.getTowerArray()[i]._ylocation *32) + 15;
Expand All @@ -244,7 +244,7 @@ public void drawAOEAttack(int x, int y, int range, Graphics g){
}

public void drawAllAOEAttacks(TowerFactory TF, Graphics g){
for(int i = 0; i < TF.getNum(); i++){
for(int i = 1; i < TF.getNum(); i++){
if( TF.getTowerArray()[i].basicDealDamage() && TF.getTowerArray()[i].type == TowerTypes.AOE){
drawAOEAttack((TF.getTowerArray()[i]._xlocation * 32) + 15, (TF.getTowerArray()[i]._ylocation *32) + 15,TF.getTowerArray()[i].getRange(), g);

Expand Down
2 changes: 1 addition & 1 deletion src/TowerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public int assignTotalDamage(int x, int y) {
int total = 0;
while (i < quantity) {
if (0 == (towerarray[i].type.compareTo(TowerTypes.AOE))) {
total += towerarray[i].dealDamage(x, y);
total += towerarray[i].inRange(x, y);
}
i++;
}
Expand Down
5 changes: 3 additions & 2 deletions src/TowerMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public TowerMock(int id, int xloc, int yloc, boolean isTower, TowerTypes type, M
_isTower = isTower;
if (!isTower) {
health = 20;
_power = 0;
}

this.type=type;
Expand Down Expand Up @@ -77,7 +78,7 @@ public boolean findMinion() {
return false;
}
if (m.isAlive()) {
if (1 == dealDamage(m.getX(), m.getY())) {
if (1 == inRange(m.getX(), m.getY())) {
currentTarget = m;
return true;
}
Expand All @@ -89,7 +90,7 @@ public boolean findMinion() {



public int dealDamage(int x, int y) {
public int inRange(int x, int y) {
int deltax = (32*_xlocation - x);
int deltay = (32*_ylocation - y);
int dist2 = deltax*deltax + deltay*deltay;
Expand Down

0 comments on commit 4afbb76

Please sign in to comment.