diff --git a/MathHero_Kyle/src/Addition.java b/MathHero_Kyle/src/Addition.java index 5d79d9c..7469306 100644 --- a/MathHero_Kyle/src/Addition.java +++ b/MathHero_Kyle/src/Addition.java @@ -1,24 +1,13 @@ public class Addition extends Enemy { - protected String problem; - protected int solution; - public Addition() { super(.6); int n1 = (int)(Math.random()*9)+1; int n2 = (int)(Math.random()*9)+1; solution = n1+n2; - problem = ""+n1+"+"+n2; - } - - public String getProblem() - { - return problem; - } - - public int getSolution() - { - return solution; + problem = n1+"+"+n2; + radius = 5; + int x7=72; } } \ No newline at end of file diff --git a/MathHero_Kyle/src/BigAddition.java b/MathHero_Kyle/src/BigAddition.java index 8afbdb5..3b2a7c3 100644 --- a/MathHero_Kyle/src/BigAddition.java +++ b/MathHero_Kyle/src/BigAddition.java @@ -1,25 +1,12 @@ public class BigAddition extends Enemy { - protected String problem; - protected int solution; - public BigAddition() { super(.3); int n1 = (int)(Math.random()*90)+10; int n2 = (int)(Math.random()*90)+10; solution = n1+n2; - problem = ""+n1+"+"+n2; + problem = n1+"+"+n2; radius = 15; } - - public String getProblem() - { - return problem; - } - - public int getSolution() - { - return solution; - } } \ No newline at end of file diff --git a/MathHero_Kyle/src/BigMultiplication.java b/MathHero_Kyle/src/BigMultiplication.java index 3767702..08746c6 100644 --- a/MathHero_Kyle/src/BigMultiplication.java +++ b/MathHero_Kyle/src/BigMultiplication.java @@ -1,25 +1,12 @@ public class BigMultiplication extends Enemy { - protected String problem; - protected int solution; - public BigMultiplication() { super(.05); int n1 = (int)(Math.random()*90)+10; int n2 = (int)(Math.random()*90)+10; solution = n1*n2; - problem = ""+n1+"*"+n2; + problem = n1+"*"+n2; radius = 20; } - - public String getProblem() - { - return problem; - } - - public int getSolution() - { - return solution; - } } \ No newline at end of file diff --git a/MathHero_Kyle/src/Division.java b/MathHero_Kyle/src/Division.java index 9a69e58..32d72f5 100644 --- a/MathHero_Kyle/src/Division.java +++ b/MathHero_Kyle/src/Division.java @@ -1,26 +1,13 @@ public class Division extends Enemy { - protected String problem; - protected int solution; - public Division() { super(.3); int n1 = (int)(Math.random()*9)+1; int n2 = (int)(Math.random()*9)+1; solution = n1; - problem = ""+(n1*n2)+"/"+n2; + problem = n1+"/"+n2; radius = 8; color = java.awt.Color.RED; } - - public String getProblem() - { - return problem; - } - - public int getSolution() - { - return solution; - } } \ No newline at end of file diff --git a/MathHero_Kyle/src/Enemy.java b/MathHero_Kyle/src/Enemy.java index 47b01a8..5097112 100644 --- a/MathHero_Kyle/src/Enemy.java +++ b/MathHero_Kyle/src/Enemy.java @@ -4,12 +4,14 @@ public abstract class Enemy { protected double r,t,speed; protected Color color = Color.BLACK; - protected int radius = 5; + protected int radius; private boolean dying1 = false; private boolean dying2 = false; private boolean dead = false; private int alpha = 255; private int arrowR = Util.PLAYER_RADIUS+Util.ARROW_LENGTH; + protected String problem; + protected int solution; public Enemy(double speed) { @@ -85,9 +87,16 @@ else if(dying1) dying2 = true; } } + + public String getProblem() + { + return problem; + } - public abstract String getProblem(); - public abstract int getSolution(); + public int getSolution() + { + return solution; + } public void draw(Graphics g) { diff --git a/MathHero_Kyle/src/ListeningGameComponent.java b/MathHero_Kyle/src/ListeningGameComponent.java index 76b65d9..4406ceb 100644 --- a/MathHero_Kyle/src/ListeningGameComponent.java +++ b/MathHero_Kyle/src/ListeningGameComponent.java @@ -160,39 +160,6 @@ public void keyReleased(KeyEvent e) */ public void keyTyped(KeyEvent e){} - /** - * Returns weather a mouse button is pressed. - * @param b button number - * @return true if the button is pressed - */ - public boolean isMousePressed(int b) - { - if(b == 1) - return mousePressed1; - else if(b == 2) - return mousePressed2; - else if(b == 3) - return mousePressed3; - - return false; - } - - /** - * Returns weather any mouse button is pressed. - * @return true if the button is pressed - */ - public boolean isMousePressed() - { - if(mousePressed1) - return mousePressed1; - else if(mousePressed2) - return mousePressed2; - else if(mousePressed3) - return mousePressed3; - - return false; - } - /** * Returns weather a mouse button is pressed. * @param k the key pressed (Ex. "A", "B", "C"...") diff --git a/MathHero_Kyle/src/Multiplication.java b/MathHero_Kyle/src/Multiplication.java index 3ff7680..7b7c959 100644 --- a/MathHero_Kyle/src/Multiplication.java +++ b/MathHero_Kyle/src/Multiplication.java @@ -1,25 +1,12 @@ public class Multiplication extends Enemy { - protected String problem; - protected int solution; - public Multiplication() { super(.4); int n1 = (int)(Math.random()*9)+1; int n2 = (int)(Math.random()*9)+1; solution = n1*n2; - problem = ""+n1+"*"+n2; + problem = n1+"*"+n2; radius = 8; } - - public String getProblem() - { - return problem; - } - - public int getSolution() - { - return solution; - } } \ No newline at end of file diff --git a/MathHero_Kyle/src/Subtraction.java b/MathHero_Kyle/src/Subtraction.java index 912735b..1ac33cc 100644 --- a/MathHero_Kyle/src/Subtraction.java +++ b/MathHero_Kyle/src/Subtraction.java @@ -1,25 +1,13 @@ public class Subtraction extends Enemy { - protected String problem; - protected int solution; - public Subtraction() { super(.4); int n1 = (int)(Math.random()*9)+1; int n2 = (int)(Math.random()*9)+1; solution = n1; - problem = ""+(n1+n2)+"-"+n2; + problem = n1+"-"+n2; color = java.awt.Color.RED; - } - - public String getProblem() - { - return problem; - } - - public int getSolution() - { - return solution; + radius = 5; } } \ No newline at end of file