Minesweeper help with resetting the display screen

3 visualizaciones (últimos 30 días)
Nathen Eberhardt
Nathen Eberhardt el 28 de Feb. de 2020
Respondida: Walter Roberson el 28 de Feb. de 2020
How do I create code that will reset the screen back to the original code? Basically I am playing minesweeper and the player (my_position) is set on the top right of the matrix as 100. I need to reset my matrix back to -1s and the 100 at the top.. when my_position steps on a mine (or a 1 in the 'mines' matrix). mines = rand(10) > .85
I had to create a 10x10 matrix of -1s (game_window(1:10,1:10) = -1) . So when my_position on the mines field in correlation to the game_window steps on a (1) in mines I need to reset the screen to 10x10 of -1s and 100 at the top.
Any help?

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Feb. de 2020
clf() or cla()
Anything beyond that would require knowledge of how you are drawing onto the screen at present.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by