Comets Java Project

In Progress Posted Oct 31, 2010 Paid on delivery
In Progress Paid on delivery

Problem: Comets

The software company you're working for is developing a game named Comets that is similar to an old popular arcade game. The player controls a spaceship that floats around in two dimensional space, propelled by its engines and carried by its inertia. Comets are also floating around. Anything that goes off one side of the screen re-emerges on the opposite side. The player's goal is to destroy all of the comets without colliding with any of them. The situation is complicated somewhat by the fact that shooting larger comets causes them to break into several smaller comets, thus making them more difficult to avoid.

A basic game interface is already written, so you don't need to worry about drawing anything on the screen or responding to the player pressing buttons. All you need to do is write classes to represent the various objects in the game. JavaDoc specifications for these classes are provided, and here's a general outline:

SpaceObject is an abstract class representing all of the objects in game, including the comets, bullets fired by the player, and even the player's ship. This should keep track of the position, velocity, and size of the object. It provides methods for updating the object's position based on its velocity, determining whether the object is overlapping with another object, and accessors for the object's position and size. SpaceObject has static fields for the playfield width and height that are set up by the main class. These two fields should be used to determine the size of the play area for wrap-around purposes.

Shot objects represent shots fired by the player. Shots should only stay on the screen for a certain length of time, so they have an age counter that increments every time the shot is told to move. The main class will take care of removing the shot from the game based on this age.

Comet is an abstract class representing comets. LargeComet, MediumComet, and SmallComet all extend Comet. Large comets break into two medium comets when shot, and medium comets break into three small comets. Small comets are destroyed outright by being shot. Every comet has an explode() method that returns a Vector containing newly created comets that are produced by their destruction, although SmallComet should return an empty vector since it doesn't spawn additional comets.

Ship represents the player's spaceship. The ship has a direction that it is facing. The gun turret of the ship points to this direct. The ship’s direction determines the change in velocity when the ship accelerates, and the trajectory of the shots it fires. A ship has methods to turn left, turn right, accelerate, and fire shots. The fire() method returns a Shot object that originates from the tip of the ship’s gun turret and travels in the direction that the ship is facing, adjusted, of course, for the ship's own velocity. An important note about acceleration: Even though in real space objects can basically travel arbitrarily fast, it wouldn't be much fun if the ship travels so fast that you can't see it. Limit the maximum speed of the ship to 10 pixels per frame (i.e. per move()). That's fast enough for the game to be exciting, but not so fast that it's impossible to follow the ship.

CometsMain is already provided to you as part of this assignment. This is where the main method resides. This class is responsible for rendering, handling user input and managing space object interactions. The classes you write MUST be compatible with CometsMain in its original form. You must not change the implementation of CometsMain.

An input file [url removed, login to view] should be placed in the root directory of the project. This file specifies the initial layout of the comets. Each line in the file describes one comet. The string at the start of the line specifies the size of the comet ("Large", "Medium", or "Small"), the two numbers after that are the position of the comet (x and y coordinates), and the last two numbers are its velocity.

Game Constants

Shot radius – 3 pixels Ship radius – 10 pixels

Large Comet radius – 40 pixels Medium Comet radius – 30 pixels

Small Comet radius – 20 pixels Maximum ship speed – 10 pixels/frame

Ship acceleration – 0.1 pixels/frame2 Ship turning rate – π/32 radians/frame

Shot speed – 3 pixels/frame in the direction of the ship + velocity of the ship when it was fired.

Ship gun turret length – 15 pixels. The turret originates from center of the ship and points towards the direction ship is facing.

Useful Formulas

Determining if two objects overlap:

Let objects one and two be at positions (x1, y1) and (x2, y2) and have radii r1 and r2, respectively. Objects one and two overlap if:

Updating the position of an object:

Let an object at position (x0, y0) be traveling with velocity (vx, vy). Its position (x, y) after being moved is:

Accelerating the ship:

Let the ship have direction θ in radians. The change in x and y velocity when accelerating is given by:

The ship's speed, s, is:

If this speed is greater than 10, scale the velocity down by multiplying both the x and y velocities by 10/s.

Firing a shot:

If a shot is fired from a ship traveling at velocity (vship.x, vship.y) and facing at angle θ in radians, the resulting shot velocity should be:

Java

Project ID: #840168

About the project

20 proposals Remote project Active Nov 4, 2010

Awarded to:

ch001234

I know how to do this project. I can turn it in now if you like.

$30 USD in 1 day
(0 Reviews)
0.0

20 freelancers are bidding on average $145 for this job

AshwinSen

Hello, Please view PMB. Ashwin

$250 USD in 5 days
(41 Reviews)
5.7
rakib062

plz check pmb.

$150 USD in 4 days
(27 Reviews)
4.9
justj2ee

I am interested!

$230 USD in 0 days
(22 Reviews)
4.9
Nzay

I have uploaded samples of my work! Looking forward to work with you.

$130 USD in 5 days
(14 Reviews)
4.7
pawel100

Hello, I'm interested in your project, Please check PMB for more details.

$90 USD in 3 days
(15 Reviews)
4.4
pomalex

Let me help you with that.

$250 USD in 5 days
(1 Review)
1.8
tushar03cse

Hello please check pmb. Thanks

$225 USD in 5 days
(2 Reviews)
1.2
wildzone

Hello. See PM

$220 USD in 7 days
(0 Reviews)
0.0
trandong56a

Let it for me, please. I can do this project for you!

$200 USD in 7 days
(0 Reviews)
0.0
tinmap571981

Ready to start.

$80 USD in 5 days
(0 Reviews)
0.0
anji9989666121

i have good knowledge in java programing ,thanks

$100 USD in 5 days
(0 Reviews)
0.0
Maxinger

I have a greate experience in Java and can quickly realize your task.

$60 USD in 2 days
(0 Reviews)
0.0
lookingforbetter

i just finish two games minesweeper and soduco plz give me chance

$150 USD in 5 days
(0 Reviews)
0.0
Yasircoder

iam ready to do your project pls read messege

$100 USD in 10 days
(0 Reviews)
0.0
doublelo7

Java 6 certified. Please see PM.

$150 USD in 4 days
(0 Reviews)
0.0
rinma

java expert here are I.

$91 USD in 2 days
(0 Reviews)
0.0
sigutis

I've skimmed through the requirements. Nothing complicated. I've done similar games in Java before.

$100 USD in 5 days
(0 Reviews)
0.0
jagubadsha

Well I have already developed games for NYU educational projects.

$200 USD in 3 days
(0 Reviews)
0.0
sud2587

Hello, I am interested. Please check your personal mails. Hope you will consider my application.

$100 USD in 7 days
(0 Reviews)
0.0