Skip to content

Commit 7a95acc

Browse files
committed
Merge branch 'dev'
2 parents 03fb9d8 + 313ec7b commit 7a95acc

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Minesweeper
2+
3+
Minesweeper. Made with GameMaker.
4+
5+
## Features
6+
7+
- Basic 3 presets.
8+
- Mine counter.
9+
- No sound effects.
10+
- No hints.
11+
12+
## How to build
13+
14+
Open `minesweeper.yyp` with GameMaker, Click `build` tab and select `build executable`.

objects/obj_minesweeper/Create_0.gml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ mouseLeftReleased = 0;
2626
clickable = false;
2727

2828
field = noone;
29+
30+
startedAt = noone;
31+
current = noone;

objects/obj_minesweeper/Draw_0.gml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
if (width != noone && height != noone) {
22
var horizontalCenter = room_width / 2;
3-
3+
var calculatedTimespan = round(date_second_span(startedAt, current));
4+
45
hoveredBoxX = noone;
5-
hoveredBoxY = noone;
6+
hoveredBoxY = noone;
67

78
draw_set_align(fa_center, fa_middle);
89
draw_set_color(COLOR_YELLOW);
9-
draw_text(horizontalCenter, fieldRectTop - 32, string(mines - flags));
10+
draw_text(horizontalCenter - 64, fieldRectTop - 32, string(mines - flags));
11+
draw_text(horizontalCenter + 64, fieldRectTop - 32, string(calculatedTimespan));
1012

1113
for (var i = 0; i < width; i += 1) {
1214
for (var j = 0; j < height; j += 1) {

objects/obj_minesweeper/Step_0.gml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
if (width != noone && height != noone) {
2-
if (!dunked || !completed) {
2+
if (dunked || completed) {
3+
mouseLeftInput = 0;
4+
mouseLeftReleased = 0;
5+
clickable = false;
6+
} else {
7+
current = date_current_datetime();
8+
39
var hovered = hoveredBoxX != noone && hoveredBoxY != noone
410

511
mouseLeftInput = mouse_check_button(mb_left);
@@ -18,8 +24,5 @@ if (width != noone && height != noone) {
1824
if (openedBoxs + mines = size) {
1925
completed = true;
2026
}
21-
} else {
22-
mouseLeftInput = 0;
23-
mouseLeftReleased = 0;
2427
}
2528
}

scripts/scr_create_minesweeper/scr_create_minesweeper.gml

+2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ function scr_create_minesweeper(width, height, mines) {
9191
self.fieldRectBottom = verticalCenter + fieldHeight / 2;
9292
self.fieldRectLeft = horizontalCenter - fieldWidth / 2;
9393
self.fieldRectRight = horizontalCenter + fieldWidth / 2;
94+
95+
self.startedAt = date_current_datetime();
9496
};
9597

9698
return minesweeper;

0 commit comments

Comments
 (0)