diff --git a/Game.gd b/Game.gd index a768376..706abca 100644 --- a/Game.gd +++ b/Game.gd @@ -4,6 +4,10 @@ extends Node2D # TODO: # Effects! Swing, Onbeat/Offbeat, Laugh track(?), MORE COWBELLS +var touchOS = ["Android", "iOS", "BlackBerry 10"] +var keyOS = ["Windows", "X11", "OSX", "HTML5"] +var os + var thrown:bool = false var cowbell:bool = true @@ -38,6 +42,13 @@ func _ready(): return # Error! We don't have a save to load. save_game.open("user://record.save", File.READ) emit_signal("update_record",save_game.get_8()) + os = OS.get_name() + if touchOS.find(os) >= 0: + #$Instructions.rect_position = Vector2(71,98) + $Instructions.text = "Flick it!" + elif keyOS.find(os) >= 0: + #$Instructions.rect_position = Vector2(59,98) + $Instructions.text = "Press Space!" save_game.close() @@ -100,6 +111,12 @@ func _unhandled_input(event): func handleInput(type): if not thrown and type != "touch": + if touchOS.find(os) >= 0 and $Instructions.visible: + #$Instructions.rect_position = Vector2(26,98) + $Instructions.text = "Tap to catch the coin." + elif keyOS.find(os) >= 0 and $Instructions.visible: + #$Instructions.rect_position = Vector2(29,81) + $Instructions.text = "Use Space again\nto catch the coin." $EffectQuestion.visible = false $EffectQuestion.disabled = true $Effect.text = effectsName[effect] @@ -117,6 +134,8 @@ func handleInput(type): cowbell = false emit_signal("throw",step) thrown = true + yield(get_tree().create_timer(2), "timeout") + $Instructions.visible = false elif thrown and type != "flick": if not gotInput: gotInput = true diff --git a/Game.tscn b/Game.tscn index 5c570b2..b63845c 100644 --- a/Game.tscn +++ b/Game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=68 format=2] +[gd_scene load_steps=69 format=2] [ext_resource path="res://resources/textures/hand_idle_coin.png" type="Texture" id=1] [ext_resource path="res://Game.gd" type="Script" id=2] @@ -59,6 +59,7 @@ [ext_resource path="res://resources/sounds/laughtrack3.wav" type="AudioStream" id=57] [ext_resource path="res://resources/sounds/laughtrack2.wav" type="AudioStream" id=58] [ext_resource path="res://resources/sounds/catch.tres" type="AudioStream" id=59] +[ext_resource path="res://resources/sounds/startDrum.wav" type="AudioStream" id=61] [sub_resource type="SpriteFrames" id=1] animations = [ { @@ -77,11 +78,6 @@ animations = [ { "name": "throw", "speed": 60.0 }, { -"frames": [ ExtResource( 16 ), ExtResource( 14 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 15 ) ], -"loop": false, -"name": "catch", -"speed": 60.0 -}, { "frames": [ ExtResource( 16 ) ], "loop": true, "name": "startCatch", @@ -91,6 +87,11 @@ animations = [ { "loop": true, "name": "failCatch", "speed": 5.0 +}, { +"frames": [ ExtResource( 16 ), ExtResource( 14 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 15 ) ], +"loop": false, +"name": "catch", +"speed": 60.0 } ] [sub_resource type="Animation" id=2] @@ -148,39 +149,29 @@ tracks/1/keys = { [sub_resource type="SpriteFrames" id=5] animations = [ { -"frames": [ ExtResource( 23 ) ], +"frames": [ ExtResource( 24 ) ], "loop": true, -"name": "0", +"name": "1", "speed": 5.0 }, { -"frames": [ ExtResource( 21 ) ], +"frames": [ ExtResource( 22 ) ], "loop": true, -"name": "2", +"name": "3", "speed": 5.0 }, { -"frames": [ ExtResource( 24 ) ], +"frames": [ ExtResource( 21 ) ], "loop": true, -"name": "1", +"name": "2", "speed": 5.0 }, { -"frames": [ ExtResource( 22 ) ], +"frames": [ ExtResource( 23 ) ], "loop": true, -"name": "3", +"name": "0", "speed": 5.0 } ] [sub_resource type="SpriteFrames" id=6] animations = [ { -"frames": [ ExtResource( 29 ) ], -"loop": true, -"name": "0", -"speed": 5.0 -}, { -"frames": [ ExtResource( 35 ) ], -"loop": true, -"name": "2", -"speed": 5.0 -}, { "frames": [ ExtResource( 34 ) ], "loop": true, "name": "1", @@ -196,9 +187,14 @@ animations = [ { "name": "3", "speed": 5.0 }, { -"frames": [ ExtResource( 30 ) ], +"frames": [ ExtResource( 35 ) ], "loop": true, -"name": "5", +"name": "2", +"speed": 5.0 +}, { +"frames": [ ExtResource( 29 ) ], +"loop": true, +"name": "0", "speed": 5.0 }, { "frames": [ ExtResource( 31 ) ], @@ -206,14 +202,19 @@ animations = [ { "name": "7", "speed": 5.0 }, { +"frames": [ ExtResource( 28 ) ], +"loop": true, +"name": "9", +"speed": 5.0 +}, { "frames": [ ExtResource( 26 ) ], "loop": true, "name": "6", "speed": 5.0 }, { -"frames": [ ExtResource( 28 ) ], +"frames": [ ExtResource( 30 ) ], "loop": true, -"name": "9", +"name": "5", "speed": 5.0 }, { "frames": [ ExtResource( 27 ) ], @@ -226,16 +227,6 @@ animations = [ { [sub_resource type="SpriteFrames" id=8] animations = [ { -"frames": [ ExtResource( 41 ) ], -"loop": true, -"name": "0", -"speed": 5.0 -}, { -"frames": [ ExtResource( 43 ) ], -"loop": true, -"name": "2", -"speed": 5.0 -}, { "frames": [ ExtResource( 42 ) ], "loop": true, "name": "1", @@ -251,9 +242,14 @@ animations = [ { "name": "3", "speed": 5.0 }, { -"frames": [ ExtResource( 46 ) ], +"frames": [ ExtResource( 43 ) ], "loop": true, -"name": "5", +"name": "2", +"speed": 5.0 +}, { +"frames": [ ExtResource( 41 ) ], +"loop": true, +"name": "0", "speed": 5.0 }, { "frames": [ ExtResource( 50 ) ], @@ -261,14 +257,19 @@ animations = [ { "name": "7", "speed": 5.0 }, { +"frames": [ ExtResource( 40 ) ], +"loop": true, +"name": "9", +"speed": 5.0 +}, { "frames": [ ExtResource( 49 ) ], "loop": true, "name": "6", "speed": 5.0 }, { -"frames": [ ExtResource( 40 ) ], +"frames": [ ExtResource( 46 ) ], "loop": true, -"name": "9", +"name": "5", "speed": 5.0 }, { "frames": [ ExtResource( 48 ) ], @@ -318,6 +319,10 @@ laugh2 = ExtResource( 58 ) laugh3 = ExtResource( 57 ) laugh4 = ExtResource( 56 ) +[node name="startDrum" type="AudioStreamPlayer" parent="beat"] +stream = ExtResource( 61 ) +volume_db = -10.0 + [node name="Catch" type="AudioStreamPlayer2D" parent="."] position = Vector2( 94.2922, 0 ) stream = ExtResource( 4 ) @@ -327,7 +332,8 @@ catch_cheer = ExtResource( 4 ) fail = ExtResource( 5 ) [node name="CoinFail" type="Sprite" parent="."] -position = Vector2( 60.5612, 274.7 ) +visible = false +position = Vector2( 88.3344, 156.583 ) rotation = 6.28319 texture = ExtResource( 53 ) script = ExtResource( 54 ) @@ -404,7 +410,7 @@ __meta__ = { } [node name="Polygon2D" type="Polygon2D" parent="."] -position = Vector2( 0.707123, 511.945 ) +position = Vector2( 0.707123, 511.384 ) color = Color( 0.811765, 0.588235, 0, 1 ) polygon = PoolVector2Array( -409.544, -255.907, 1493.51, -256.569, 1672.88, 2724.24, 792.881, 2692.24, -407.119, 2724.24, -375.119, 132.237 ) @@ -426,24 +432,23 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Debug" type="Label" parent="."] -visible = false -margin_left = 145.497 -margin_top = 237.601 -margin_right = 185.497 -margin_bottom = 251.601 +[node name="Instructions" type="Label" parent="."] +margin_left = 29.6003 +margin_top = 81.0729 +margin_right = 166.6 +margin_bottom = 112.073 custom_colors/font_color = Color( 0, 0, 0, 1 ) -text = "Debug" +align = 1 __meta__ = { "_edit_use_anchors_": false } +[connection signal="catch" from="." to="Catch" method="_on_Game_catch"] [connection signal="catch" from="." to="Screen" method="_on_Game_catch"] [connection signal="catch" from="." to="ScoreBox" method="_on_Game_catch"] [connection signal="catch" from="." to="Hand" method="_on_Game_catch"] -[connection signal="catch" from="." to="Catch" method="_on_Game_catch"] +[connection signal="catch_fail" from="." to="Catch" method="_on_Game_catch_fail"] [connection signal="catch_fail" from="." to="CoinFail" method="_on_Game_catch_fail"] [connection signal="catch_fail" from="." to="Hand" method="_on_Game_catch_fail"] -[connection signal="catch_fail" from="." to="Catch" method="_on_Game_catch_fail"] [connection signal="throw" from="." to="Screen" method="_on_Game_throw"] [connection signal="throw" from="." to="Hand" method="_on_Game_throw"] [connection signal="update_record" from="." to="ScoreBox" method="_on_Game_update_record"] diff --git a/Hand.gd b/Hand.gd index 89ca1ee..7172ec6 100644 --- a/Hand.gd +++ b/Hand.gd @@ -66,5 +66,9 @@ func _on_Game_catch_fail(): $Animations.playback_speed = 1 $Animations.play("Search") yield(get_tree().create_timer(0.5), "timeout") + get_node("../Coin").stream = load("res://resources/sounds/grab.wav") + get_node("../Coin").play() animation = "idle" + yield(get_tree().create_timer(0.5), "timeout") + get_node("../Coin").stream = load("res://resources/sounds/flick.tres") diff --git a/beat.gd b/beat.gd index 1d470ec..fe65665 100644 --- a/beat.gd +++ b/beat.gd @@ -76,8 +76,12 @@ func playBeat(bpm, level, effect): newStep = step laugh = true if not laugh: + var start = true emit_signal("changeTheme",false) for i in range(1,7): + if start and not cowbellEffect: + $startDrum.play() + start = false if cowbellEffect: stream = cowbell elif i % 2: diff --git a/resources/sounds/grab.wav b/resources/sounds/grab.wav new file mode 100644 index 0000000..82ec5d0 Binary files /dev/null and b/resources/sounds/grab.wav differ diff --git a/resources/sounds/grab.wav.import b/resources/sounds/grab.wav.import new file mode 100644 index 0000000..fcf6e8b --- /dev/null +++ b/resources/sounds/grab.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/grab.wav-b752e9f61d7437e4106da54c22d736f4.sample" + +[deps] + +source_file="res://resources/sounds/grab.wav" +dest_files=[ "res://.import/grab.wav-b752e9f61d7437e4106da54c22d736f4.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/resources/sounds/startDrum.wav b/resources/sounds/startDrum.wav new file mode 100644 index 0000000..fa329a2 Binary files /dev/null and b/resources/sounds/startDrum.wav differ diff --git a/resources/sounds/startDrum.wav.import b/resources/sounds/startDrum.wav.import new file mode 100644 index 0000000..ed3bdef --- /dev/null +++ b/resources/sounds/startDrum.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/startDrum.wav-97b4caea6ad6c5cb7e2fd4857fd6e340.sample" + +[deps] + +source_file="res://resources/sounds/startDrum.wav" +dest_files=[ "res://.import/startDrum.wav-97b4caea6ad6c5cb7e2fd4857fd6e340.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0