Skip to content
17 changes: 3 additions & 14 deletions MathHero_Kyle/src/Addition.java
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually its garbage

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha i hate myself

problem = ""+n1+"+"+n2;
}

public String getProblem()
{
return problem;
}

public int getSolution()
{
return solution;
problem = n1+"+"+n2;
radius = 5;
int x7=72;
}
}
15 changes: 1 addition & 14 deletions MathHero_Kyle/src/BigAddition.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
15 changes: 1 addition & 14 deletions MathHero_Kyle/src/BigMultiplication.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
15 changes: 1 addition & 14 deletions MathHero_Kyle/src/Division.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
15 changes: 12 additions & 3 deletions MathHero_Kyle/src/Enemy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
33 changes: 0 additions & 33 deletions MathHero_Kyle/src/ListeningGameComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"...")
Expand Down
15 changes: 1 addition & 14 deletions MathHero_Kyle/src/Multiplication.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
16 changes: 2 additions & 14 deletions MathHero_Kyle/src/Subtraction.java
Original file line number Diff line number Diff line change
@@ -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;
}
}