Forums - C# Corner

Forum guidelines

create array and change color button

Oct 28 2009 6:09 AM
Hi,
You help me this game

using windows forms

This game is a single-player game. it consists of a form with 25 buttons, as shown in the following:
1   2   3   4   5
6   7   8   9  10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

the time elapsed(in seconds) will appear on the screen.

When the game starts, all the button are green in color, when a player clicks a button, the color of that button and its adjacent buttons in the same row and column changes. For example, if a button is green, its color changes to red; and if it is red, its color changes to green. To win the game, the player needs to click the buttons in such a manner that all the buttons turn red.

when a player clicks a button, the color of the following buttons will change:
the button that was clicked
the button above the clicked button
the button below the clicked button
the button to the left of the clicked button
the button to the right of the clicked button

for example, if a player clicks 7, the color of 2, 6, 7, 8 and 12 will change.

for a button in the first row, there is no button above it. therefore, if a button in the first row is clicked, the corresponding button in the last row will also change its color. for example, if a player clicks 2, the color of 1, 2, 3, 7, and 22 will change.

for a button in the last row, there is no button below it. therefore, if a button in the last row is clicked, the corresponding button in the first row will also change its color. for example, if a player clicks 22, the color of 2, 17, 21, 22, and 23 will change.

for a button in the first column, there is no button to its left, therefore, if a button in the first column is clicked, the corresponding button in the last column will also change its color. for example, if a player clicks 11, the color of 6, 11, 12, 15 and 16 will change.

for a button in the last column, there is no button to its right. therefore, if a button in the last column is clicked, the corresponding button in the first column will also change its color. for example, if player clicks 15, the color of 10, 11, 14, 15 and 20 will change.

for button at the corners, two of the adjacent buttons are missing. for example, 1 is located in the first row and in the first column. there is no button above it and to its the left. therefore, if a player clicks 1, the color of 1, 2, 5, 6 and 21 will change.

the player will interact with the game by using a mouse or a keyboard.

there should be an option to check the top score by clicking a button. clicking this button will display the scoreboard in the following format:
name:##########
time:##########(Secs)

if the player is able to finish the game in a record time, he/she will be asked to enter his/her name. the name and the new time will be stored in a file and displayed whenever the game starts.

Answers (1)

techbash 2016

SPONSORED BY

File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!