-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a2810d
commit c3be30f
Showing
10 changed files
with
1,670 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//Arrow | ||
import java.awt.*; | ||
|
||
class Arrow{ | ||
private int damage, x, y, width = 50, height = 25; | ||
private String direction; | ||
public Arrow(int damage, String direction, int x, int y){//constructor | ||
this.damage = damage; | ||
this.direction = direction; | ||
this.x = x; | ||
this.y = y + 10;//add 10 to move bullet down so standing on cannon doesn't collide | ||
} | ||
public void move(){//method moves arrow | ||
if(direction.equals("left")){ | ||
x -= 10; | ||
} | ||
if(direction.equals("right")){ | ||
x += 10; | ||
} | ||
} | ||
public int getX(){ | ||
return x; | ||
} | ||
public int getY(){ | ||
return y; | ||
} | ||
public Rectangle getRect(Player man){ | ||
return new Rectangle(x, y, width, height); | ||
} | ||
public Rectangle getRealRect(Player man){ | ||
return new Rectangle(x - man.getXPos(), y, width, height); | ||
} | ||
public int getDamage(){//returns damage of arrow | ||
return damage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @(#)Ground.java | ||
* | ||
* | ||
* @author | ||
* @version 1.00 2018/6/6 | ||
*/ | ||
|
||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
import java.awt.image.*; | ||
import java.io.*; | ||
import javax.imageio.ImageIO; | ||
import java.awt.image.BufferedImage; | ||
|
||
class Block{ | ||
private String type; | ||
private int x, y; | ||
private Rectangle rect; | ||
|
||
public Block(int xx, int yy, String t){//constructor | ||
x = xx; | ||
y = yy; | ||
type = t; | ||
rect = new Rectangle(x, y, 50, 50); | ||
} | ||
|
||
public Rectangle getRect(){//returns rect | ||
return rect; | ||
} | ||
|
||
public int getX(){//returns x | ||
return x; | ||
} | ||
|
||
public int getY(){//returns y | ||
return y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//Cannon | ||
import java.awt.*; | ||
|
||
class Cannon{ | ||
private int x, y, xPos; | ||
public Cannon(int x, int y, int xPos){ | ||
this.x = x; | ||
this.y = y; | ||
this.xPos = xPos; | ||
} | ||
public Arrow shoot(Player man){//creates arrow object at cannon | ||
return new Arrow(10, "left", x, y + 10); | ||
} | ||
//Getter methods | ||
public int getX(){ | ||
return x; | ||
} | ||
public int getY(){ | ||
return y; | ||
} | ||
public int getXPos(){ | ||
return xPos; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* @(#)Coin.java | ||
* | ||
* | ||
* @author | ||
* @version 1.00 2018/6/1 | ||
*/ | ||
|
||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
import java.awt.image.*; | ||
import java.io.*; | ||
import javax.imageio.ImageIO; | ||
import java.awt.image.BufferedImage; | ||
|
||
public class Coin { | ||
private int x, y, newY; | ||
private double frame; | ||
private boolean picked; | ||
|
||
public Coin(int xx, int yy) { | ||
x = xx; | ||
y = yy; | ||
newY = yy; | ||
frame = 0; | ||
picked = false; | ||
} | ||
|
||
public void addNewY(){ | ||
newY -= 2; | ||
} | ||
|
||
public void setPickedTrue(){//changes coin to picked | ||
picked = true; | ||
} | ||
//frames for coin graphics | ||
public void increaseFrame(){ | ||
if (frame > 9){ | ||
frame = 0; | ||
} | ||
else{ | ||
frame += 0.1; | ||
} | ||
} | ||
|
||
public void speedFrame(){ | ||
if (frame > 9){ | ||
frame = 0; | ||
} | ||
else{ | ||
frame += 0.6; | ||
} | ||
} | ||
|
||
public int getFrame(){ | ||
return (int) frame; | ||
} | ||
|
||
public boolean getPicked(){ | ||
return picked; | ||
} | ||
|
||
public int getNewY(){ | ||
return newY; | ||
} | ||
|
||
public int getX(){ | ||
return x; | ||
} | ||
|
||
public int getY(){ | ||
return y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* @(#)Fireball.java | ||
* | ||
* | ||
* @author | ||
* @version 1.00 2018/6/7 | ||
*/ | ||
|
||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
import java.awt.image.*; | ||
import java.io.*; | ||
import javax.imageio.ImageIO; | ||
import java.awt.image.BufferedImage; | ||
|
||
public class Fireball { | ||
double x, y, vy; | ||
int restCount; | ||
double vOrg; | ||
boolean rest = false; | ||
|
||
public Fireball(int xx, int yy, double dist) {//constructor | ||
x = xx; | ||
y = yy; | ||
vOrg = -dist/50; | ||
vy = vOrg; | ||
} | ||
|
||
public void jump(){//jump method | ||
if (!rest){ | ||
vy += 0.15; | ||
y += vy; | ||
} | ||
} | ||
|
||
public void reset(){//resets fireball | ||
y = 950; | ||
vy = vOrg; | ||
rest = true; | ||
} | ||
|
||
public void refresh(){//if resting add to restCount | ||
if (rest){ | ||
if (restCount >= 100){ | ||
rest = false; | ||
restCount = 0; | ||
} | ||
else{ | ||
restCount++; | ||
} | ||
} | ||
} | ||
//getter methods | ||
public boolean getRest(){ | ||
return rest; | ||
} | ||
|
||
public int getX(){ | ||
return (int) x; | ||
} | ||
|
||
public int getY(){ | ||
return (int) y; | ||
} | ||
} |
Oops, something went wrong.