Question
Help needed.....Java Programming(Object-Orientated) Netbean IDE 8.2 Description of the Problem You are required to write a simple game called Treasure Hunt which applying the Pythagorean
Help needed.....Java Programming(Object-Orientated) Netbean IDE 8.2
Description of the Problem
You are required to write a simple game called Treasure Hunt which applying the Pythagorean Theorem to determine when a game sprites are touching.
Task 1:
Create the following class to represent the sprite objects in the game.
Sprite |
Name: String x: x location y: y location |
+ toString(): String + setName(String): void + setX(int): void + setY(int): void + getName(): int + getX(): int + getY(): int + collide(Sprite) : boolean
|
Task 2:
Create 10 treasure boxes randomly as sprite objects and stored in an array list. For time being, just set all the treasure boxes name as Treasure Box. All the treasure boxes location must be in range 1 to 800.
Task 3:
Let user enter the player name and location (Figure 1.0). Again, you have to ensure the location (x & y) must be in range 1 to 800. Other values are considered invalid.
Task 4:
After the player details were capture, you have to determine the distance in between the player and each treasure box. You are required to implement the collide method found in the Sprite class. If the players x and y within 20 pixels of the treasure boxs x and y, the method will return true. Otherwise false will be returned.
You will win the match if you can get a treasure box within 3 guesses.
Input Input Input ?Enter Player Name: ? Enter Player X location: ? Enter Player Y location: Tornad OK Cancel OK Cancel OK Cancel Figure 1.0: Capturing Player Details Input Input Input ?Enter Player Name: ? Enter Player X location: ? Enter Player Y location: Tornad OK Cancel OK Cancel OK Cancel Figure 1.0: Capturing Player Details
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started