Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Windows Forms Application C#, write code for a simple game modeled after the brick-breaking game Breakout where a ball bounces off the sides and

Using Windows Forms Application C#, write code for a simple game modeled after the brick-breaking game Breakout where a ball bounces off the sides and top of the screen and destroys bricks that it comes into contact with and is kept in play by a user controlled paddle at the bottom of the screen. - The ball will bounce off the side or top walls - If the ball comes into contact with a brick, the brick will be removed and the players score will increase by 15 points and the ball will bounce off it - If the ball comes into contact with the paddle, the ball will bounce off it - the paddle shouldnt be able to move of the screen - If the player touches he bottom of the screen, have a text-box pop out saying: " Oh no! Try again!" - If the player destroys all the bricks, a text box will pop out saying: " Great job! You won!!" - Regardless of whether or not a player wins or loses they will be asked if they want to play again with a text box saying: " Play again?" - If the player hits the space bar, restart the game automatically, but if the player hits exit - exit the game - The bricks would have a colour of red, the ball would be black, the paddle will be white The proposed solution for creating a simple game modeled after the brick-breaking game Breakout in Windows Forms Application C# will involve the following: Proposed inputs: User input from keyboard to control the movement of the paddle, space bar to restart the game, and exit to exit the game. Proposed outputs: Visual display of the ball bouncing off the walls and paddle, bricks being removed, score increasing, and text boxes displaying messages to the player. Form design: The form will include a panel for the game area, a label for the score, and buttons for restarting and exiting the game. Programming needed to process the inputs to get the desired outputs: The program will use event procedures to respond to user input, check for collisions between the ball and bricks/paddle, and update the score and display accordingly. Proposed variables: Double for the x and y coordinates of the ball, integers for the score and number of bricks, string for the messages displayed to the player, and Boolean for checking if the game is over. Proposed arrays: An array of bricks to be displayed on the screen, and an array of Booleans to keep track of which bricks have been hit. The code should include: Selections structures: If statements will be used to check for collisions and determine if the game is over. Constants: Will be used to set the speed and direction of the ball, and the dimensions of the bricks and paddle. Loops: For and while loops will be used to iterate through the arrays of bricks and update their status. Form controls, properties, and event procedures: The form will include buttons for restarting and exiting the game, and event procedures will be used to respond to user input. Graphics: The ball, bricks, and paddle will be drawn using the Graphics object. Arrays: Arrays will be used to keep track of the bricks and their status. Methods: At least two programmer-created methods will be used, one for updating the position of the ball and one for checking for collisions. File Input/Output: File I/O will not be used in this game.

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