flynn.gg

Christopher Flynn

Machine Learning
Systems Architect,
PhD Mathematician

Home
Projects
Open Source
Blog
Résumé

GitHub
LinkedIn

Blog


Building Minesweeper in Unity

2019-05-04 Feed

Because I didn’t contribute as much as I had hoped to in Ludum Dare 44, I decided I should learn a bit of Unity to be a bit more useful in the next game jam.

To learn the engine a bit more, I decided to build a working version of Minesweeper. It took a few days of late nights to build, but here is my working (probably not bug-free) WebGL build, exported from a Unity project.

The graphics are the same as the original version on Windows XP, found from a bit of googling for spritesheets.

minesweeper

All of the objects in the scene have SpriteRenderer components, with BoxCollider2D components on the cells and the smiley for input detection and handling. The sprites themselves are autogenerated from Unity’s sprite editor tool, which is able to automatically detect the bounds of the sprites from the above spritesheet.

I also took the time to code in the mine flagging functionality as well as the left+right click mechanic which reveals adjacent non-flagged cells.

Further reading

Minesweeper

minesweeper

Back to the posts.