How to Make Minesweeper In Godot | Beginner Tutorial

Поділитися
Вставка
  • Опубліковано 27 вер 2024
  • Learn the basics of Godot by making a mine sweeper clone in this tutorial.
    The code for the game is built from scratch and will re-create all the features of minesweeper. This will use tilemaps with various layers for the mines, numbers, grass and flag tiles. Recursion will also be used to reveal some of the tiles.
    Code and assets for this video: github.com/rus...

КОМЕНТАРІ • 36

  • @NagaGaming76
    @NagaGaming76 5 місяців тому +1

    Thank you soo much for making this! I've always wanting to do a more "challenging" project to start out with but all other tutorials were all outdated. Not only was this tutorial very insightful, it also provided a smooth lesson into each of godot's mechanics. Good job!

  • @kshawn2579
    @kshawn2579 11 місяців тому +2

    Thanks Russ! You are so underrated. From Pygame to Ursina to Godot. What a Legend!

  • @thehogman.
    @thehogman. 11 місяців тому +4

    Thanks for all the tutorials. If I could, I'd recommend solitaire next. Thanks again!

    • @CodingWithRuss
      @CodingWithRuss  11 місяців тому +4

      For some reason I hadn't considered card games, that could be an interesting one to work on!

  • @sergeiseniuto627
    @sergeiseniuto627 3 місяці тому +1

    Awesome!!!! Love your lessons!!!

  • @qingxian3870
    @qingxian3870 4 місяці тому

    thank you bro, im learning alot from this video.
    I followed the video step by step and finished it !
    And i actually learned a lot ,now i know how to use array and loop
    And i think we no need a move_mine() function.
    If first click is not empty cell, we can while a new_game() function until a cell is empty 🤔

  • @danirookie
    @danirookie 5 місяців тому

    Learning a lot with this tutorial. Short doubt: is there any Tilemap method that returns what item from your tileset you're clicking on? ie: a function that returns the original tileset position that corresponds to a given tile you click on. I'm just trying with get_cell_tile_data(number_layer, map_pos) to get the Number i'm clicking on but no success so far. Many thanks!

  • @LukaGG600
    @LukaGG600 Місяць тому

    Do the new tilemap layers change the tutorial too much?

  • @ghb323
    @ghb323 8 місяців тому

    50:17 the flood fill algorithm. Get adjicent cells that meets a condition

  • @cccornel5965
    @cccornel5965 8 місяців тому +3

    Awesome tutorial to learn how to use arrays

  • @MultiLeandrini
    @MultiLeandrini 8 місяців тому

    If mines and numbers are never placed on top of each other couldn't we put them in the same layer?

  • @hanazosimp
    @hanazosimp 11 місяців тому

    can u make playlist for the basic pygame functions pls, it will help me learn alot better

  • @dovos8572
    @dovos8572 4 місяці тому

    at 17:30 you are using 2 for loops to iterate over the tilemap to search for the mines. why aren't you just using the mines array that you created before in the mines layer? that would mean you only need one for loop and a simple check if it is at the border.
    then just add +1 around the mine cell. after each mine cell is looped through the surrounding cells should be set correctly.
    to do the +1 you just need to add +1 to the atlas x coordinate.
    this should simplify that part of the code quite a bit.
    also i don't know if you change that later in the video, so this comment might not be as relevant.
    now at 25:50 i'm really confused what you are doing. it seems that you are doing the inverse of what i thought should be done with the first part of my comment. why are you searching the 8 cells around an empty cell and hope that a bomb is in it? using that exact function on the bomb would give you all cells that need to increment it's shown number. you don't need to go through all empty cells of the tilemap and count the surrounding bombs that COULD be there.

    • @dovos8572
      @dovos8572 4 місяці тому

      for those interested, this is what i thought it would be.
      @export var Columns : int = 16
      @export var Rows : int = 16
      @export var MineCount : int = 10
      @export var Mine_positions : Array[Vector2i]
      enum Layers {Background, Mines, Numbers, Gras, Pointer}
      func create_mines():
      var mine_texture = Vector2i(5,1)
      for i in range(MineCount):
      var mine_pos : Vector2i = Vector2i(randi_range(0, Columns-1), randi_range(0, Rows-1))
      while Mine_positions.has(mine_pos):
      mine_pos = Vector2i(randi_range(0, Columns-1), randi_range(0, Rows-1))
      Mine_positions.append(mine_pos)
      set_cell(Layers.Mines, mine_pos, 0, mine_texture)
      func create_numbers():
      var target_cell : Vector2i
      for mine_pos in Mine_positions:
      for x in range(3):
      for y in range(3):
      target_cell = mine_pos + Vector2i(x - 1, y - 1)
      if target_cell != mine_pos and !Mine_positions.has(target_cell) :
      if (target_cell.x >= 0 and target_cell.x = 0 and target_cell.y

  • @mmjuuno
    @mmjuuno 11 місяців тому

    hey russ, my pygame window suddenly started to take a while to load, do you know what might be the cause?

  • @SEOmaster_real
    @SEOmaster_real 11 місяців тому +1

    cool< want more video!

  • @furrydoggolol
    @furrydoggolol 9 місяців тому +1

    i paused at 48:18 and accidentally completed a minesweeper lol

  • @tungbeso4751
    @tungbeso4751 11 місяців тому

    I hope you make a game match 3

  • @rezashir3873
    @rezashir3873 11 місяців тому +1

    you are amazing🙃😊

  • @luckyheropro
    @luckyheropro 2 місяці тому

    I watched yours and CyberPotatos Godot 4 Tutorial. No comparison. His tut was faulty and unelegant. Big probs!

  • @PythonAnalyticsData
    @PythonAnalyticsData 11 місяців тому

    what language do you use in godot?

    • @CodingWithRuss
      @CodingWithRuss  11 місяців тому +3

      It's GD Script, Godot's own language. It's very similar to python

    • @kshawn2579
      @kshawn2579 10 місяців тому

      and js@@CodingWithRuss

    • @MrYellowPlays
      @MrYellowPlays 10 місяців тому

      ​​​@@CodingWithRussI'm learning python but Pygame is quite limited, if I learn python and then switch to Godot would it be possible to use Python the way it's used on Pygame, the same way in Godot?

    • @CodingWithRuss
      @CodingWithRuss  10 місяців тому +1

      @@MrYellowPlays Godot uses its own language GDScript but it is very similar to python so switching from pygame to godot will be easier if you are already learning python. There will still be a lot to learn in the godot engine itself as it is quite different to using pygame

    • @MrYellowPlays
      @MrYellowPlays 10 місяців тому

      Should I keep learning python or just switch to Godot straight away?@@CodingWithRuss

  • @uh7123zz1azxcv
    @uh7123zz1azxcv 11 місяців тому +2

    Thanks! Glad you're returning to the code along style
    I know it's much more demanding in terms of time and effort, much appreciated Russ
    Thanks again for the nice tutorial

  • @evelynchew2523
    @evelynchew2523 5 місяців тому +2

    Thanks again! Learned something new from this tutorial.

  • @nulloWorld
    @nulloWorld 3 місяці тому

    This was very helpful, because I am new to Godot. That being said future viewers of this project should bear in mind that this tutorial is somewhat buggy. It is possible to get negative flags, the hover layer should disappear on game end and the left right mine sweep thing allows you to open surrounding cells even if flag count is greater than the number cell's number, it should not let you do this. Also the way that a mine is repositioned after the first click will result in mines being located in the top left corner at a higher rate than expected. But I did learn a lot about how Godot works so thanks :D