Skip to content

Commit b404db9

Browse files
committedAug 16, 2020
First version done
1 parent 6d1ea05 commit b404db9

File tree

8 files changed

+15
-8
lines changed

8 files changed

+15
-8
lines changed
 

‎app/main.rb

+12-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
def tick args
2727
args.lowrez.background_color = [91, 110, 225]
28-
# args.lowrez.background_color = [255,255,255]
2928

3029
background_image args
3130
init_state args
@@ -36,7 +35,6 @@ def tick args
3635
reset_game_state args
3736

3837
main_loop args
39-
4038
# render_debug args
4139
end
4240

@@ -57,12 +55,16 @@ def background_image args
5755
end
5856

5957
def init_state args
58+
if args.state.tick_count == 0
59+
args.outputs.sounds << "sound/tiny-tty-theme.ogg"
60+
end
6061
args.state.wrong_key ||= false
6162
args.state.score ||= 0
6263
args.state.player_name ||= ""
6364
args.state.leader_fetch ||= nil
6465
args.state.leaders ||= []
6566
args.state.prefetch ||= $gtk.http_get "https://tiny-tty-server.herokuapp.com"
67+
args.state.muted ||= false
6668
end
6769

6870
def main_loop args
@@ -118,12 +120,12 @@ def main_loop args
118120
h: 24,
119121
path: "sprites/logo.png",
120122
}
121-
args.lowrez.labels << { x: 33, y: 30, text: "and enter",
123+
args.lowrez.labels << { x: 33, y: 30, text: "enter",
122124
size_enum: LOWREZ_FONT_SM, alignment_enum: 1,
123125
r: 153, g: 229, b: 80, a: 255,
124126
font: "fonts/pixel-4x5.ttf" }
125127

126-
args.lowrez.labels << { x: 33, y: 23, text: "the keys",
128+
args.lowrez.labels << { x: 33, y: 23, text: "the letters",
127129
size_enum: LOWREZ_FONT_SM, alignment_enum: 1,
128130
r: 153, g: 229, b: 80, a: 255,
129131
font: "fonts/pixel-4x5.ttf" }
@@ -282,7 +284,6 @@ def main_loop args
282284
end
283285

284286
if ratio_done >= 1
285-
# reset_game_state(args, true)
286287
args.state.screen = :game_over
287288
end
288289
end
@@ -296,12 +297,14 @@ def chosen_key?(args)
296297
args.state.time_passed = 0 # countdown for subsequent keys
297298
args.state.correct_keys += 1 # countdown for subsequent keys
298299
args.state.score += DIFFICULTY_SCORE[args.state.difficulty] * 100
300+
args.gtk.queue_sound "sound/g5drum.ogg" if !args.state.muted
299301
elsif @chosen_key && args.inputs.keyboard.key_down.truthy_keys.length > 0 && args.inputs.keyboard.key_down.truthy_keys[0] == :char
300302
args.state.wrong_key = true
301303
args.state.wrong_key_time = args.state.tick_count
302304
if args.state.score > 0
303305
args.state.score -= DIFFICULTY_SCORE[args.state.difficulty] * 100
304306
end
307+
args.gtk.queue_sound "sound/c5drum.ogg" if !args.state.muted
305308
end
306309

307310
@chosen_key ||= ALLOWED_KEYS.sample
@@ -348,6 +351,10 @@ def reset_game_state(args, force = false)
348351
elsif args.inputs.keyboard.key_down.space! && args.state.screen != :game && args.state.screen != :game_over
349352
args.state.leader_post = { complete: true } # stub POST of score
350353
args.state.screen = :leaderboard
354+
elsif args.inputs.keyboard.key_down.m && args.state.screen != :game && args.state.screen != :game_over
355+
args.gtk.stop_music
356+
args.state.muted = !args.state.muted
357+
args.outputs.sounds << "sound/tiny-tty-theme.ogg" if !args.state.muted
351358
end
352359
end
353360

‎metadata/game_metadata.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
devid=mauro-oto
22
devtitle=Mauro Otonelli
3-
gameid=http-test
4-
gametitle=Tiny TTY (http test)
5-
version=0.1
3+
gameid=tiny-tty
4+
gametitle=Tiny TTY
5+
version=1.0
66
icon=metadata/icon.png

‎metadata/icon copy.png

25.7 KB
Loading

‎sound/c5drum.ogg

6.4 KB
Binary file not shown.

‎sound/f5drum.ogg

6.29 KB
Binary file not shown.

‎sound/g5drum.ogg

6.24 KB
Binary file not shown.

‎sound/tiny-tty-theme.ogg

357 KB
Binary file not shown.

‎sprites/flame.png

-78 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.