diff options
-rw-r--r-- | Assets/Visuals/logo_sum_on.png | bin | 0 -> 38322 bytes | |||
-rw-r--r-- | Assets/Visuals/logo_sum_on.png.import | 34 | ||||
-rw-r--r-- | Levels/game.tscn | 206 | ||||
-rw-r--r-- | Reusable Scenes/number_node.tscn | 3 | ||||
-rw-r--r-- | Scripts/GameLoop.gd | 1 | ||||
-rw-r--r-- | Scripts/NumberNode.gd | 60 | ||||
-rw-r--r-- | project.godot | 4 |
7 files changed, 270 insertions, 38 deletions
diff --git a/Assets/Visuals/logo_sum_on.png b/Assets/Visuals/logo_sum_on.png Binary files differnew file mode 100644 index 0000000..54d8c60 --- /dev/null +++ b/Assets/Visuals/logo_sum_on.png diff --git a/Assets/Visuals/logo_sum_on.png.import b/Assets/Visuals/logo_sum_on.png.import new file mode 100644 index 0000000..c74e904 --- /dev/null +++ b/Assets/Visuals/logo_sum_on.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bqupm6ocy7rta" +path="res://.godot/imported/logo_sum_on.png-19d23bf55249618718bb613f881bc559.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Visuals/logo_sum_on.png" +dest_files=["res://.godot/imported/logo_sum_on.png-19d23bf55249618718bb613f881bc559.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Levels/game.tscn b/Levels/game.tscn index c3df8e6..17094fb 100644 --- a/Levels/game.tscn +++ b/Levels/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=24 format=3 uid="uid://rd1m2fu22g1s"] +[gd_scene load_steps=26 format=3 uid="uid://rd1m2fu22g1s"] [ext_resource type="PackedScene" uid="uid://ccvoi0qmvlxmj" path="res://Reusable Scenes/number_node.tscn" id="1_j877y"] [ext_resource type="Script" path="res://Scripts/Generator.gd" id="1_uaslf"] @@ -21,6 +21,103 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_ludyn"] size = Vector2(38, 38) +[sub_resource type="Animation" id="Animation_dkjtm"] +resource_name = "mod" +length = 2.0 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("TextureRect2:scale:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0, 0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5, 1.5, 2) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("TextureRect2:scale:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 0, 0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5, 1.5, 2) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("TextureRect:scale:x") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0, 0, 0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5, 1.5, 2) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("TextureRect:scale:y") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0, 0, 0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0.08, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5, 1.5, 2) +} +tracks/4/type = "bezier" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("ModifierLabel:theme_override_colors/font_color:r") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/5/type = "bezier" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("ModifierLabel:theme_override_colors/font_color:g") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/6/type = "bezier" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("ModifierLabel:theme_override_colors/font_color:b") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/7/type = "bezier" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("ModifierLabel:theme_override_colors/font_color:a") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"handle_modes": PackedInt32Array(0, 0, 0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.7, 1.5, 2.1) +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_gpmpl"] +_data = { +"mod": SubResource("Animation_dkjtm") +} + [sub_resource type="CircleShape2D" id="CircleShape2D_ml6nm"] radius = 260.83 @@ -180,30 +277,66 @@ collision_priority = 9999.0 [node name="CollisionShape2D" type="CollisionShape2D" parent="Player/PlayerArea2D"] shape = SubResource("RectangleShape2D_ludyn") -[node name="ModifierLabel" type="Label" parent="Player"] -visible = false +[node name="Control" type="Control" parent="Player"] +layout_mode = 3 +anchors_preset = 0 +offset_left = -19.0 +offset_top = -66.0 +offset_right = 21.0 +offset_bottom = -26.0 +mouse_filter = 1 + +[node name="TextureRect2" type="TextureRect" parent="Player/Control"] +modulate = Color(0.458824, 0, 0.105882, 1) +layout_mode = 0 +offset_left = -22.0 +offset_top = 2.99997 +offset_right = 1002.0 +offset_bottom = 515.0 +rotation = -0.170645 +scale = Vector2(1e-05, 1e-05) +texture = ExtResource("13_8aorr") + +[node name="TextureRect" type="TextureRect" parent="Player/Control"] +modulate = Color(0.85098, 0.0666667, 0.2, 1) +layout_mode = 0 +offset_left = -19.0 +offset_top = -3.0 +offset_right = 1005.0 +offset_bottom = 509.0 +scale = Vector2(1e-05, 1e-05) +texture = ExtResource("13_8aorr") + +[node name="ModifierLabel" type="Label" parent="Player/Control"] +layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 -offset_left = -31.0 -offset_top = -59.0 -offset_right = 31.0 -offset_bottom = -36.0 +offset_left = -30.0 +offset_top = -34.0 +offset_right = 32.0 +offset_bottom = -11.0 grow_horizontal = 2 grow_vertical = 0 -theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_colors/font_color = Color(1, 1, 1, 0) theme_override_fonts/font = ExtResource("4_5ifsc") text = "+ X" horizontal_alignment = 1 vertical_alignment = 1 script = ExtResource("5_lj1b3") -[node name="Timer" type="Timer" parent="Player/ModifierLabel"] +[node name="Timer" type="Timer" parent="Player/Control/ModifierLabel"] wait_time = 2.0 +[node name="AnimationPlayer" type="AnimationPlayer" parent="Player/Control"] +libraries = { +"": SubResource("AnimationLibrary_gpmpl") +} + [node name="AI" parent="." instance=ExtResource("1_j877y")] +z_index = 80 position = Vector2(1207, 52) do_scanning = false color = Color(0.921569, 0.403922, 0.627451, 1) @@ -235,29 +368,64 @@ shape = SubResource("CircleShape2D_4p6y7") target_position = Vector2(0, 0) collide_with_areas = true -[node name="ModifierLabel" type="Label" parent="AI"] -visible = false +[node name="Control" type="Control" parent="AI"] +layout_mode = 3 +anchors_preset = 0 +offset_left = -19.0 +offset_top = -66.0 +offset_right = 21.0 +offset_bottom = -26.0 +mouse_filter = 1 + +[node name="TextureRect2" type="TextureRect" parent="AI/Control"] +modulate = Color(0.458824, 0, 0.105882, 1) +layout_mode = 0 +offset_left = -22.0 +offset_top = 2.99997 +offset_right = 1002.0 +offset_bottom = 515.0 +rotation = -0.170645 +scale = Vector2(1e-05, 1e-05) +texture = ExtResource("13_8aorr") + +[node name="TextureRect" type="TextureRect" parent="AI/Control"] +modulate = Color(0.85098, 0.0666667, 0.2, 1) +layout_mode = 0 +offset_left = -19.0 +offset_top = -3.0 +offset_right = 1005.0 +offset_bottom = 509.0 +scale = Vector2(1e-05, 1e-05) +texture = ExtResource("13_8aorr") + +[node name="ModifierLabel" type="Label" parent="AI/Control"] +layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 -offset_left = -31.0 -offset_top = -59.0 -offset_right = 31.0 -offset_bottom = -36.0 +offset_left = -30.0 +offset_top = -34.0 +offset_right = 32.0 +offset_bottom = -11.0 grow_horizontal = 2 grow_vertical = 0 -theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_colors/font_color = Color(1, 1, 1, 0) theme_override_fonts/font = ExtResource("4_5ifsc") text = "+ X" horizontal_alignment = 1 vertical_alignment = 1 script = ExtResource("5_lj1b3") -[node name="Timer" type="Timer" parent="AI/ModifierLabel"] +[node name="Timer" type="Timer" parent="AI/Control/ModifierLabel"] wait_time = 2.0 +[node name="AnimationPlayer" type="AnimationPlayer" parent="AI/Control"] +libraries = { +"": SubResource("AnimationLibrary_gpmpl") +} + [node name="NumberNode" parent="." instance=ExtResource("1_j877y")] position = Vector2(95, 551) @@ -772,5 +940,5 @@ text = "[space] for done" [connection signal="timeout" from="GameLoop/BetweenPlayerAndAI" to="GameLoop" method="_on_between_player_and_ai_timeout"] [connection signal="timeout" from="GameLoop/AudioDelay" to="GameLoop" method="_on_audio_delay_timeout"] [connection signal="input_event" from="Player/PlayerArea2D" to="Player/Player" method="_on_player_area_2d_input_event"] -[connection signal="timeout" from="Player/ModifierLabel/Timer" to="Player/ModifierLabel" method="_on_timer_timeout"] -[connection signal="timeout" from="AI/ModifierLabel/Timer" to="AI/ModifierLabel" method="_on_timer_timeout"] +[connection signal="timeout" from="Player/Control/ModifierLabel/Timer" to="Player/Control/ModifierLabel" method="_on_timer_timeout"] +[connection signal="timeout" from="AI/Control/ModifierLabel/Timer" to="AI/Control/ModifierLabel" method="_on_timer_timeout"] diff --git a/Reusable Scenes/number_node.tscn b/Reusable Scenes/number_node.tscn index 74e5559..d2d6dcb 100644 --- a/Reusable Scenes/number_node.tscn +++ b/Reusable Scenes/number_node.tscn @@ -91,5 +91,8 @@ stream = ExtResource("4_flqws") [node name="Ouch" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("5_peh70") +[node name="ModifierTimer" type="Timer" parent="."] + [connection signal="mouse_entered" from="NumberArea2D" to="NumberArea2D" method="_on_mouse_entered"] [connection signal="mouse_exited" from="NumberArea2D" to="NumberArea2D" method="_on_mouse_exited"] +[connection signal="timeout" from="ModifierTimer" to="." method="_on_modifier_timer_timeout"] diff --git a/Scripts/GameLoop.gd b/Scripts/GameLoop.gd index 6446fbd..9edc99a 100644 --- a/Scripts/GameLoop.gd +++ b/Scripts/GameLoop.gd @@ -39,6 +39,7 @@ func _on_between_player_and_ai_timeout(): if current_turns >= turns: win_control.visible = true anim.play("win") + anim_label.size = Vector2(1280, 720) if GlobalVariables.player.get_node("..").value > GlobalVariables.ai.get_node("..").value: anim_label.text = "YOU won!" elif GlobalVariables.player.get_node("..").value < GlobalVariables.ai.get_node("..").value: diff --git a/Scripts/NumberNode.gd b/Scripts/NumberNode.gd index 5fc4742..b15f535 100644 --- a/Scripts/NumberNode.gd +++ b/Scripts/NumberNode.gd @@ -29,6 +29,9 @@ enum Operations { var size : float = 1 +var stored_node +var stored_prev_value + func _ready(): size = sprite.scale.x target_pos = position @@ -48,32 +51,25 @@ func join_from(node : NumberNode): node.value += self.value - var modifier_label = node.get_node_or_null("ModifierLabel") - - if self.modifier_operation == Operations.ADDITION: - node.value += roundi(self.modifier) - if modifier_label: modifier_label.pop("+ " + str(self.modifier)) - if self.modifier_operation == Operations.SUBTRACTION: - node.value -= roundi(self.modifier) - if modifier_label: modifier_label.pop("- " + str(self.modifier)) - if self.modifier_operation == Operations.MULTIPLICATION: - node.value = roundi(float(node.value) * self.modifier) - if modifier_label: modifier_label.pop("* " + str(self.modifier)) - if self.modifier_operation == Operations.DIVISION: - node.value = roundi(float(node.value) / float(self.modifier)) - if modifier_label: modifier_label.pop("/ " + str(self.modifier)) + if self.modifier_operation != Operations.NONE: + $"ModifierTimer".start() + GlobalVariables.gameloop.get_node("BetweenPlayerAndAI").wait_time = 2 + stored_node = node + stored_prev_value = prev_value + else: + GlobalVariables.gameloop.get_node("BetweenPlayerAndAI").wait_time = 1 node.target_pos = self.position node.update_visuals() if node.value >= prev_value: - print("YYY") node.get_node("Score").playing = true else: - print("NNOOOOOO") node.get_node("Ouch").playing = true + + visible = false - queue_free() + if self.modifier_operation == Operations.NONE: queue_free() func update_visuals(): label.text = str(self.value) @@ -111,3 +107,33 @@ func softlock_check(): get_node(GlobalVariables.NODE).add_child(new) new.softlock_check() + + +func _on_modifier_timer_timeout(): + var node = stored_node + var prev_value = stored_prev_value + + var modifier_label = node.get_node_or_null("Control/ModifierLabel") + + if self.modifier_operation == Operations.ADDITION: + node.value += roundi(self.modifier) + if modifier_label: modifier_label.pop("+ " + str(self.modifier)) + if self.modifier_operation == Operations.SUBTRACTION: + node.value -= roundi(self.modifier) + if modifier_label: modifier_label.pop("- " + str(self.modifier)) + if self.modifier_operation == Operations.MULTIPLICATION: + node.value = roundi(float(node.value) * self.modifier) + if modifier_label: modifier_label.pop("* " + str(self.modifier)) + if self.modifier_operation == Operations.DIVISION: + node.value = roundi(float(node.value) / float(self.modifier)) + if modifier_label: modifier_label.pop("/ " + str(self.modifier)) + + node.get_node("Control/AnimationPlayer").play("mod") + node.update_visuals() + + if node.value >= prev_value: + node.get_node("Score").playing = true + else: + node.get_node("Ouch").playing = true + + queue_free() diff --git a/project.godot b/project.godot index 9c05ae9..b3b9050 100644 --- a/project.godot +++ b/project.godot @@ -10,10 +10,10 @@ config_version=5 [application] -config/name="Ludum Dare 55" +config/name="Sum on!" run/main_scene="res://Levels/game.tscn" config/features=PackedStringArray("4.2", "GL Compatibility") -config/icon="res://icon.svg" +config/icon="res://Assets/Visuals/logo_sum_on.png" [autoload] |