Design a game in java, JAVA Programming

Assignment Help:

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.


Related Discussions:- Design a game in java

Pattern printing program, Question Using 3 level of nested for loop, writ...

Question Using 3 level of nested for loop, write a program that will produce the output as below.

Java error handling mechanism, Errors: When a dynamic linking failure or ...

Errors: When a dynamic linking failure or some other "hard" failure in the virtual machine happens, the virtual machine gives an Error. Typical Java programs could not find Error

Break statement, The break statement is utilized for terminating the curren...

The break statement is utilized for terminating the current While or For loop and after that transferring program control towards statement just after the terminated loop. The foll

Convert string to super ascii, A string S is said to be "Super ASCII", if i...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''a''''-''''z'''') and

Who can an applet talk to, Who Can an Applet Talk To? By default an app...

Who Can an Applet Talk To? By default an applet can just open network connections to the system from that the applet was downloaded. This system is known as the codebase. An ap

Polymorphism carbonfootprint interface program, (CarbonFootprint Interface:...

(CarbonFootprint Interface: Polymorphism) Using interfaces, as you learned in this chapter, you can specify similar behaviors for possibly disparate classes. Governments and compan

Loops, Use a while loop to count down from 100 and display all the numbers ...

Use a while loop to count down from 100 and display all the numbers in the * following pattern (you have to figure out what the pattern is - don''t go below 0): * 100 99 97 94

Describe the concept of encapsulation, Describe the concept of Encapsulatio...

Describe the concept of Encapsulation  Encapsulation is a technique which is used for hiding properties and behaviors of an object and allowing outside access only as appropria

Draw a use case diagram in uml, Extend the given drawing program (the versi...

Extend the given drawing program (the version that allows undo and redo) as follows: a) Allow the user to select font and font size; user should also be able to boldface, underl

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd