tumblr-game 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tumblr-game/gosu.rb +27 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 927d5a6a65757a1175612dda35192ad9cc22fbe2
|
4
|
+
data.tar.gz: 8dd9d5a5f5b697953e4e958fd0fa088588340d18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7610af4b2263156957803438096754fce02cd5b44007674ab3fb301ce12d2d3834964dc2bc86f3869ec97ea048e1500f07144093b9719dd20724ba648c879fe8
|
7
|
+
data.tar.gz: 45af0d7d4a54abe9d015e5f1a33dc2a6c919a363e122729472bf4c526ef3c1e9c1243112295e68b4964e4594d45cb20fe6c866a29897b15371fe510b1a3e57fb
|
data/lib/tumblr-game/gosu.rb
CHANGED
@@ -137,12 +137,21 @@ class MyWindow < Gosu::Window
|
|
137
137
|
|
138
138
|
## draw function. this function will draw one of the three backgrounds for the game. if the game is in the LOSE state, if the time has run out and the
|
139
139
|
# player has not matched 5 tiles, the player loses. if the player matches 5 tiles before the time runs out, then they win. else, the regular game
|
140
|
-
# board is drawn for the user to play on
|
140
|
+
# board is drawn for the user to play on.
|
141
|
+
# when the user wins or loses, that screen is displayed for 120 frames and the window calls its close function to exit properly
|
141
142
|
def draw
|
142
143
|
if (!@win and @lose) or (@frameCounter == 0 and @game_board.return_count < 5 and @timer.return_time == 0)
|
143
144
|
draw_lose
|
145
|
+
@frameCounter += 1
|
146
|
+
if @frameCounter == 120
|
147
|
+
close_window
|
148
|
+
end
|
144
149
|
elsif (@win and !@lose)
|
145
150
|
draw_win
|
151
|
+
@frameCounter += 1
|
152
|
+
if @frameCounter == 120
|
153
|
+
close_window
|
154
|
+
end
|
146
155
|
elsif (!@win and !@lose)
|
147
156
|
draw_background
|
148
157
|
@game_board.draw_board
|
@@ -157,7 +166,7 @@ class MyWindow < Gosu::Window
|
|
157
166
|
# variable is set to true and the game stores which tile was picked and flipped.
|
158
167
|
def pick_tiles
|
159
168
|
if button_down? Gosu::KbEscape then
|
160
|
-
|
169
|
+
close_window
|
161
170
|
end
|
162
171
|
if @phase == 0
|
163
172
|
if button_down? Gosu::MsLeft then
|
@@ -339,4 +348,20 @@ class MyWindow < Gosu::Window
|
|
339
348
|
@lose = true
|
340
349
|
end
|
341
350
|
end
|
351
|
+
|
352
|
+
## this function will close out the current window and delete all of the files that were made during execution of the game
|
353
|
+
def close_window
|
354
|
+
delete( File.join(Dir.home, 'Desktop/image1.png')
|
355
|
+
File.join(Dir.home, 'Desktop/image2.png')
|
356
|
+
File.join(Dir.home, 'Desktop/image3.png')
|
357
|
+
File.join(Dir.home, 'Desktop/image4.png')
|
358
|
+
File.join(Dir.home, 'Desktop/image5.png')
|
359
|
+
File.join(Dir.home, 'Desktop/image6.png')
|
360
|
+
File.join(Dir.home, 'Desktop/image7.png')
|
361
|
+
File.join(Dir.home, 'Desktop/image8.png')
|
362
|
+
File.join(Dir.home, 'Desktop/image9.png')
|
363
|
+
File.join(Dir.home, 'Desktop/image10.png')
|
364
|
+
)
|
365
|
+
close
|
366
|
+
end
|
342
367
|
end
|