Design a game in java, JAVA Programming

Ten pigs were all in a pen, enjoying their morning slop when a bird flew down from a nearby tree and began picking all the best bits out from the trough. This greatly perturbed the pigs and so the pig brothers and pig sisters went to the back of their sty and rolled out their hog-howitzer, determined to knock the smug look off the bird's face (and in fact, knock the entire bird out of the tree!)

Mechanics:

The game generates a random number from 0 to 173.  This represents the height of the bird, which rests at the top of the tree. The player then has 10 shots to knock the bird out of the tree by firing pigs at it. The player fires the pigs with the hog-howitzer, which can be angled from zero to 60 degrees.  The angle can be changed either allowing the player to type in a number, or using the up and down barrel buttons which will raise or lower the angle of the howitzer by half a degree with each click.  The game should not allow the angles to be raised above 60 or below 0, appropriate warnings should be given.  The game should also error check for junk data in the text box, with an appropriate error. 
 
To see if the player hits the target, first convert the degrees from the text box to radians (by multiplying it by Π/180) .  The gun and the tree are 100 feet apart, so using high school trigonometry the player's shot is calculated as tan(n)*100, where n is the degrees after being converted to radians.  If the value computed from the user's input is within plus or minus 2 of the random number, the player has knocked the bird from the tree and wins.  Otherwise, the user is told that their shot is too high or too low. If the bird remains in the trees after all 10 shots, the player loses.  Note, the game should show the player their number of remaining shots.

The game should also have a menu bar with an option to quit, or reset.  Reset returns all values to origin and generates a new random height for the bird.

Posted Date: 2/18/2013 2:37:41 AM | Location : United States







Related Discussions:- Design a game in java, Assignment Help, Ask Question on Design a game in java, Get Answer, Expert's Help, Design a game in java Discussions

Write discussion on Design a game in java
Your posts are moderated
Related Questions
Preventing Applet Based Social Engineering Attacks To help avoid this, Java applet windows are specifically labeled as such along with an ugly bar that says: "Warning: Applet W

Too many function invocations between the server and the client will lead to network overhead, tight coupling due to dependencies between the server and the client, misuse of serve

Relate java with JVM Java performance gets better each year as JVM gets smarter. This works, since making JVM smarter doesn't require any great change to the java language, sou

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Explain the term Naming Packages in details? As you saw previously name space conflicts arise if two pieces of code declare the similar name. Java remains track of what belongs

Maintenance and Administration activities: Name                        : e-Commerce OS and Soft wares    : Websphere 6.0, IHS, Unix, Weblogic 8.1   Maintenance an


Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to make beans on demand, such as a bean that encapsulates the business logic t

The game of Life, invented by John Conway, is supposed to model the genetic laws for birth, survival, and death (see Scienti_c American, October 1970, p. 120). We will play it on a

Explain Arithmetic Promotion and Binary Operations? An int divided through an int is an int, and a double divided by a double is a double, but what about an int divided by a do