Make Minesweeper in C using Raylib | FULL TUTORIAL
In this video tutorial, we're going through the process of creating a Minesweeper type of game from start to finish! We'll be coding it in the C language using the Raylib game library. We're also going to add in some sound effects, game states such as a Main Menu and Options screen and have a lot of fun in the process!
Minesweeper Rules
--------------------------------
A player selects a cell to open it. If a player opens a cell containing a mine, the game ends in a loss. Otherwise, the opened cell displays either a number, indicating the number of mines diagonally and/or adjacent to it, or a blank tile (sometimes shown as a 0), and all adjacent cells will automatically be opened.
👉👉Grab the source (on github): https://github.com/erikyuzwa/raylib-minesweeper
🔗Links & References:
- Raylib website: https://www.raylib.com/
- Raylib github: https://github.com/raysan5/raylib
- Raylib API Cheatsheet: https://www.raylib.com/cheatsheet/cheatsheet.html
- JSFXR Sound Effects Generator: https://sfxr.me/
- Music: https://pixabay.com/music/search/8bit/?pagi=2
- DrawTexturePro Demo: https://tradam.itch.io/raylib-drawtexturepro-interactive-demo
👋🏻Connect with me:
Twitter: https://www.twitter.com/eyuzwa
===---=== Chapters ===---===
0:00:00 - Introduction
0:00:43 - Minesweeper Demo
0:02:49 - Official Minesweeper Rules
0:06:38 - Create Project in VS 2022
0:07:24 - Setting Up main.c
0:07:54 - Stubbing out Game* Functions
0:10:36 - First Test
0:11:15 - Rendering our Tile Grid
0:12:17 - Creating our Tile Structure
0:18:19 - Placing the Mines in the Grid
0:21:36 - Demo of Mines in the Grid
0:22:25 - Calculating Nearby Mines Count
0:26:14 - Rendering the Nearby Mine Count
0:28:41 - Reveal Chosen Tiles
0:29:59 - Handling Left Mouse Button Input
0:35:29 - Testing LMB Click
0:36:00 - Handling the RMB for Planting a Flag
0:36:42 - Loading Texture Data from Image(s)
0:39:13 - DrawTexturePro
0:40:45 - Back to Handling RMB
0:43:07 - RevealTilesFrom a Tile
0:47:26 - Explaining Game State Machines
0:50:24 - Creating a GameState enum
0:51:22 - Updating GameRender with switch support
0:52:15 - Updating GameUpdate with switch support
0:55:03 - Rendering Main Menu
0:57:55 - Rendering the Lose Screen
1:00:06 - Rendering the Win Screen
1:02:22 - Adding Sound Effects and Music
1:08:42 - BONUS - Adding Audio Toggles and Options Screen
1:14:03 - Wrapping Up!
#raylib #minesweeper #gamedev
Other Videos By Erik Yuzwa
Other Statistics
Minesweeper Statistics For Erik Yuzwa
Currently, Erik Yuzwa has 1,472 views for Minesweeper across 1 video. There's close to an hours worth of content for Minesweeper published on his channel, or 2.44% of the total watchable video on Erik Yuzwa's YouTube channel.