Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve the attached problems with Java GUI. Find all the necessary informations to solve the problem in the following attachment You may work in Pairs

Solve the attached problems with Java GUI. Find all the necessary informations to solve the problem in the following attachment image text in transcribed
image text in transcribed
image text in transcribed
You may work in Pairs on this assignment if you wish** For this assignment you will create a dodgy pipe game using java swing and awt classes. The game will mimic the recently popular flappy bird game Dodgy Pipe Game High Score: 106 Your game should Use a Timer to advance pipe graphic obstacles from right to left across the screen, the obstacles should be generated randomly and the player will score points each time they maneuver past a set of pipes (their position surpasses the position of a pipe) using only the mouse to control the vertical position of a character on the screen (without hitting the top or bottom of the screen) Keep track of the score on the screen for the user to see. The game should go forever and keep track of a high score using a simple text file Use basic Graphics drawing mechanisms for the pipe obstacles Each time the user clicks the mouse their character should elevate temporarily and otherwise should accelerate towards the ground. Usea formula as follows to simulate a flappy bird' style flap position.y +vertSpeed delta; vertSpeed += FALLING-RATE * delta; with values until I got something liked. My position is updated each 15 milliseconds (using the same timer that updates the pipes and score and checks for game over situations) Your game should stop if the game character collides with a pipe, or the top or bottom of the screen. You may display a "game over" message or the current score or ask the user to play again at this point Feel free to elaborate your game as you see fit. You can download a character of your choosing to act as the obstacle I just googled for a transparent game character and you can find many - keep in mind rectangular characters work a little better (or at least characters that are comprised of rectangle-type shapes), the pipes should be drawn with basic Graphics drawing mechanisms (such as two polygon shapes for each pipe) Tips and Hints 1. Think modularly - or in an object oriented way. My solution has a Pipe class to handle drawing and updating the positions of a pipe on screen, a landscape class that keeps track of an ArrayList of pipes and asks them slide to the left each time a timer goes off, a game character class to keep track of the game character, and update the character's position, etc. 2. Draw the pipes on graph paper first so you can get them working first Don't worry about moving or generating them randomly or anything like that to start. Get them drawing such that the gap in between the pipes is configurable. In my solution I specify two things for the pipes, the top of the bottom pipe and the gap between the pipes. My Pipe class then translates the polygons (one polygon for the top pipe and one for the bottom pipe) into the correct positions. My pipes are large so that they extend off the screen in either direction (then when I translate up or down they are still visible) 3. Once a single pipe is sliding left to right across the screen you are well on your way. To make the game character 'jump or flap' upwards on mouse clicks you should implement a basic Mouse Event Listener. The randomness of the pipes is not too complicated, once the last pipe has passed a certain x location you can randomly decide whether to generate another pipe at the edge of the screen or not. You may work in Pairs on this assignment if you wish** For this assignment you will create a dodgy pipe game using java swing and awt classes. The game will mimic the recently popular flappy bird game Dodgy Pipe Game High Score: 106 Your game should Use a Timer to advance pipe graphic obstacles from right to left across the screen, the obstacles should be generated randomly and the player will score points each time they maneuver past a set of pipes (their position surpasses the position of a pipe) using only the mouse to control the vertical position of a character on the screen (without hitting the top or bottom of the screen) Keep track of the score on the screen for the user to see. The game should go forever and keep track of a high score using a simple text file Use basic Graphics drawing mechanisms for the pipe obstacles Each time the user clicks the mouse their character should elevate temporarily and otherwise should accelerate towards the ground. Usea formula as follows to simulate a flappy bird' style flap position.y +vertSpeed delta; vertSpeed += FALLING-RATE * delta; with values until I got something liked. My position is updated each 15 milliseconds (using the same timer that updates the pipes and score and checks for game over situations) Your game should stop if the game character collides with a pipe, or the top or bottom of the screen. You may display a "game over" message or the current score or ask the user to play again at this point Feel free to elaborate your game as you see fit. You can download a character of your choosing to act as the obstacle I just googled for a transparent game character and you can find many - keep in mind rectangular characters work a little better (or at least characters that are comprised of rectangle-type shapes), the pipes should be drawn with basic Graphics drawing mechanisms (such as two polygon shapes for each pipe) Tips and Hints 1. Think modularly - or in an object oriented way. My solution has a Pipe class to handle drawing and updating the positions of a pipe on screen, a landscape class that keeps track of an ArrayList of pipes and asks them slide to the left each time a timer goes off, a game character class to keep track of the game character, and update the character's position, etc. 2. Draw the pipes on graph paper first so you can get them working first Don't worry about moving or generating them randomly or anything like that to start. Get them drawing such that the gap in between the pipes is configurable. In my solution I specify two things for the pipes, the top of the bottom pipe and the gap between the pipes. My Pipe class then translates the polygons (one polygon for the top pipe and one for the bottom pipe) into the correct positions. My pipes are large so that they extend off the screen in either direction (then when I translate up or down they are still visible) 3. Once a single pipe is sliding left to right across the screen you are well on your way. To make the game character 'jump or flap' upwards on mouse clicks you should implement a basic Mouse Event Listener. The randomness of the pipes is not too complicated, once the last pipe has passed a certain x location you can randomly decide whether to generate another pipe at the edge of the screen or not

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions