Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronBeneteau authored Oct 16, 2022
1 parent 5a2810d commit c3be30f
Show file tree
Hide file tree
Showing 10 changed files with 1,670 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Arrow.java
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;
}
}
41 changes: 41 additions & 0 deletions Block.java
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;
}
}
24 changes: 24 additions & 0 deletions Cannon.java
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;
}
}
76 changes: 76 additions & 0 deletions Coin.java
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;
}
}
67 changes: 67 additions & 0 deletions Fireball.java
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;
}
}
Loading

0 comments on commit c3be30f

Please sign in to comment.