Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java game

uetian_cute
uetian_cute 


It is a game in java. Attachments Tags Clarifications

Answers

java game

uetian_cute
uetian_cute 



wonderful game of air fightimg Attachments
dogfight (1).zip (71 K) Download





















Preview
y location. */ public Pos(double x, double y) { this.x = x; this.y = y; } /** * Get the x location * @return the x location */ public double getX() { return x; } /** * Set a new x location. *

Preview
radius. * @param x the center points x value * @param y the center points y value * @param r the radius */ public Bounds(double x, double y, double r) { super(x, y); this.r = r; } /** * Gets the radius. * @return the radius */ public double getRadius()

Preview
Updates the projectiles position. * @param delta the time in milliseconds since the last call. */ @Override public void update(int delta) { //move it in the y direction moveY(getSpeed() * delta); //move it in the x direction moveX(getSpeed() * delta); //if it flies off the map, remove it if (getX()

Preview
is small, draw a small explosion StdDraw.picture(x, y, "img/smallExplode.png"); } } /** * Updates the time the explosion has left. * @param delta the time in milliseconds since the last call. */ public void update(int delta) { //decrease the time left by delta time -= delta; //if the time reaches

Preview
= "You killed " + space.getEnemiesKilled() + " out of a total" + " of " + space.getTotalEnemies() + " enemies."; //write the game score String bigScore = "Your final score: " + space.getScore(); //ask to replay String replay = "Press 'r' to play again."; //draw all the text StdDraw.text(50,

Preview
0, 1)); } /** * Creates a new DogfightObject with the given speed and bounds. * @param speed the speed * @param bounds the circle bounds */ public DogfightObject(double speed, Bounds bounds) { this.speed = speed; this.bounds = bounds; } /** * Get the bounds. * @return the bounds. */

Preview
dogfight.geom.Bounds; /** * This is the enemy; it can be created on its own, or a random enemy with * random attributes can be created. */ public class EnemyAircraft extends AerialObject { //This whole first chunk is for creating random enemies //possible fire rates (-1 means that the enemy does not

Preview
moveAngle(double dif) { deg += dif; } /** * Get the current angle. * @return the angle in degrees. */ public double getAngle() { return deg; } /** * Sets this objects battle space, and then adds this object to that * battle space. * @param space the battle space

Preview
addExp = new ArrayList<Explosion>(); removeExp = new ArrayList<Explosion>(); //add a player FriendlyAircraft.createPlayer(.04, new Bounds(1.5, 50, 3), this); //set the number of ships left and the total starting enemies this.numShips = numShips; this.totalEnemies = numShips; } /** * Draws all objects */ public void draw() { for (AerialObject o :

Preview
{ //set up singleton because there should only be one player private static FriendlyAircraft player; /** * Degree Moving Speed. */ private double dms = .1; /** * How often the player can fire its projectiles. */ private double fireRate = 150; /** * How long until it can

Preview
* @param y an array of all the y-coordindates of the polygon */ public static void filledPolygon(double[] x, double[] y) { int N = x.length; GeneralPath path = new GeneralPath(); path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0])); for (int i = 0; i < N; i++) path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i])); path.closePath(); offscreen.fill(path); draw();

Preview
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://www.netbeans.org/ns/project/1"> <type>org.netbeans.modules.java.j2seproject</type>

Preview
--> <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="DogFight-impl"> <fail message="Please build using Ant 1.7.1 or higher."> <condition> <not> <antversion atleast="1.7.1"/> </not> </condition> </fail> <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> <!--

Preview

Preview
DogFight.</description> <import file="nbproject/build-impl.xml"/> <!-- There exist several targets which are by default empty and which can be used for execution of your tasks. These targets are usually executed before and after some main targets. They are: -pre-init: called before initialization of project properties -post-init: called after initialization

Screenshots
Screenshot
Purchase Answer