tumblr-game 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tumblr-game/gosu.rb +27 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f2e946e75c124f097739b2f876922810f515e2a
4
- data.tar.gz: 41513f1ef8f16b758dad3848ba774b5b7c7ac961
3
+ metadata.gz: 927d5a6a65757a1175612dda35192ad9cc22fbe2
4
+ data.tar.gz: 8dd9d5a5f5b697953e4e958fd0fa088588340d18
5
5
  SHA512:
6
- metadata.gz: 8ff927a6dae28bb31b2e2f149f06066f11efb9ae7e4396157c32094d1e1ec093266f9e9022b060a8de2ac70f496510551f4006db6c079d775e299bb2684752b8
7
- data.tar.gz: 2062e86e906035b4938c52b4e1be7071931a7d8fe45364fca863e7583fcb622097833eb7b4ba2b46f01aac0af6570e90e4b69d8c8298806a89e4d7af947eb3fe
6
+ metadata.gz: 7610af4b2263156957803438096754fce02cd5b44007674ab3fb301ce12d2d3834964dc2bc86f3869ec97ea048e1500f07144093b9719dd20724ba648c879fe8
7
+ data.tar.gz: 45af0d7d4a54abe9d015e5f1a33dc2a6c919a363e122729472bf4c526ef3c1e9c1243112295e68b4964e4594d45cb20fe6c866a29897b15371fe510b1a3e57fb
@@ -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
- close
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumblr-game
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Canero