diff --git a/.godot/editor/create_recent.Node b/.godot/editor/create_recent.Node index cfe456a..2d5bdec 100644 --- a/.godot/editor/create_recent.Node +++ b/.godot/editor/create_recent.Node @@ -1,16 +1,22 @@ -Button HBoxContainer +TextureRect +Control +Sprite2D +Label +Button +GridContainer +ItemList +VScrollBar +VBoxContainer Panel +CollisionShape2D +CollisionPolygon2D +Node2D +Area2D CanvasLayer -VBoxContainer ScrollContainer -Control AnimationPlayer TextureButton -Node2D -Sprite2D -CollisionShape2D -Area2D Timer RigidBody2D Marker2D diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index cec94f0..b754fd0 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -14,7 +14,7 @@ dock_split_1=0 dock_split_4=0 dock_2="FileSystem" dock_3="Scene,Import" -dock_5="Inspector,Node,History,Commit (11)" +dock_5="Inspector,Node,History,Commit (20)" [EditorNode] @@ -22,7 +22,7 @@ open_scenes=["res://Scenes/game_world.tscn", "res://Scenes/horse.tscn", "res://S [ScriptEditor] -open_scripts=["res://Scripts/Cupcake Spawn Timer.gd", "res://Scripts/Cupcakes/cupcake.gd", "res://Scripts/game_world.gd", "res://Scripts/horse.gd", "res://Scripts/PlayArea.gd", "res://README.md"] +open_scripts=["res://Scripts/Cupcake Spawn Timer.gd", "res://Scripts/Cupcakes/cupcake.gd", "res://Scripts/game_world.gd", "res://Scripts/horse.gd", "res://Scripts/ingame_ui.gd", "res://Scripts/PlayArea.gd", "res://README.md", "res://Scripts/upgrades.gd", "res://Scripts/varConst.gd", "res://Scripts/varVar.gd"] open_help=["Node"] script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 index 19c42fc..8c9cf07 100644 --- a/.godot/editor/filesystem_update4 +++ b/.godot/editor/filesystem_update4 @@ -10,3 +10,6 @@ res://README.md res://Scenes/UI/ingame_ui.tscn res://Scripts/PlayArea.gd res://Scenes/UI/upgrades.tscn +res://Scripts/upgrades.gd +res://Scripts/ingame_ui.gd +res://Scripts/varVar.gd diff --git a/.godot/editor/game_world.gd-folding-311f987771454061e6fc42e0351495f3.cfg b/.godot/editor/game_world.gd-folding-311f987771454061e6fc42e0351495f3.cfg index e860dd4..762d715 100644 --- a/.godot/editor/game_world.gd-folding-311f987771454061e6fc42e0351495f3.cfg +++ b/.godot/editor/game_world.gd-folding-311f987771454061e6fc42e0351495f3.cfg @@ -1,3 +1,3 @@ [folding] -sections_unfolded=PackedStringArray() +sections_unfolded=PackedStringArray("Resource") diff --git a/.godot/editor/game_world.tscn-editstate-bdbf2ba254a2078c85b005689e1549ff.cfg b/.godot/editor/game_world.tscn-editstate-bdbf2ba254a2078c85b005689e1549ff.cfg index 75cffa5..91041d0 100644 --- a/.godot/editor/game_world.tscn-editstate-bdbf2ba254a2078c85b005689e1549ff.cfg +++ b/.godot/editor/game_world.tscn-editstate-bdbf2ba254a2078c85b005689e1549ff.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-605.908, -556.88), +"ofs": Vector2(-531.369, -614.342), "primary_grid_steps": 8, "show_edit_locks": true, "show_guides": true, diff --git a/.godot/editor/game_world.tscn-folding-bdbf2ba254a2078c85b005689e1549ff.cfg b/.godot/editor/game_world.tscn-folding-bdbf2ba254a2078c85b005689e1549ff.cfg index a1a041b..04294d1 100644 --- a/.godot/editor/game_world.tscn-folding-bdbf2ba254a2078c85b005689e1549ff.cfg +++ b/.godot/editor/game_world.tscn-folding-bdbf2ba254a2078c85b005689e1549ff.cfg @@ -1,5 +1,5 @@ [folding] -node_unfolds=[NodePath("."), PackedStringArray("Transform", "Material", "Texture", "Ordering", "Visibility", "Editor Description", "Process", "ccVanilla"), NodePath("Location"), PackedStringArray("Visibility"), NodePath("PlayArea"), PackedStringArray("Input", "Collision"), NodePath("PlayArea/Cupcake"), PackedStringArray("Collision"), NodePath("PlayArea/CollisionShape2D"), PackedStringArray("Transform", "Visibility")] -resource_unfolds=["res://Scenes/game_world.tscn::RectangleShape2D_sh03e", PackedStringArray()] +node_unfolds=[NodePath("."), PackedStringArray("Transform", "Material", "Texture", "Ordering", "Visibility", "Editor Description", "Process", "ccVanilla"), NodePath("Location"), PackedStringArray("Visibility"), NodePath("Upgrades"), PackedStringArray("Layer"), NodePath("Cupcakes/Cupcake"), PackedStringArray("Collision"), NodePath("PlayArea"), PackedStringArray("Input", "Collision", "Visibility"), NodePath("PlayArea/CollisionShape2D"), PackedStringArray("Transform", "shape")] +resource_unfolds=["res://Scenes/game_world.tscn::RectangleShape2D_g5fj2", PackedStringArray()] nodes_folded=[] diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 60b637d..5aa956e 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -10,10 +10,10 @@ run_reload_scripts=true [dialog_bounds] -project_settings=Rect2(814, 506, 1120, 920) +project_settings=Rect2(814, 520, 1120, 920) editor_settings=Rect2(830, 520, 900, 700) search_help=Rect2(640, 390, 1280, 720) -export=Rect2(830, 430, 900, 700) +export=Rect2(830, 460, 900, 700) [color_picker] @@ -22,7 +22,7 @@ recent_presets=PackedColorArray(0.181189, 0.0715467, 0.241084, 1, 0.16746, 0.092 [recent_files] scenes=["res://Scenes/UI/ingame_ui.tscn", "res://Scenes/UI/Upgrades.tscn", "res://Scenes/Locations/yard.tscn", "res://Scenes/Locations/y.tscn", "res://Scenes/Locations/Yard.tscn", "res://Scenes/Cupcakes/cupcake.tscn", "res://Scenes/horse.tscn", "res://Scenes/game_world.tscn", "res://Scenes/cupcake.tscn"] -scripts=["res://Scripts/PlayArea.gd", "res://README.md", "res://Scripts/Cupcakes/cupcake.gd", "res://Scripts/Cupcake Spawn Timer.gd", "Node", "res://Scripts/game_world.gd", "res://Scripts/horse.gd"] +scripts=["res://Scripts/varConst.gd", "res://Scripts/varVar.gd", "res://Scripts/ingame_ui.gd", "res://Scripts/upgrades.gd", "res://Scripts/PlayArea.gd", "res://README.md", "res://Scripts/Cupcakes/cupcake.gd", "res://Scripts/Cupcake Spawn Timer.gd", "Node", "res://Scripts/game_world.gd"] [script_setup] diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index d3d74f1..60cddb7 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -3,10 +3,10 @@ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 10, +"column": 21, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 4, +"row": 17, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" @@ -17,10 +17,10 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 0, +"column": 31, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 48, +"row": 107, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" @@ -48,7 +48,7 @@ state={ "column": 0, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 13, +"row": 25, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" @@ -73,10 +73,74 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 21, +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 12, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://Scripts/upgrades.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 21, +"scroll_position": 0.0, +"selection": true, +"selection_from_column": 0, +"selection_from_line": 21, +"selection_to_column": 28, +"selection_to_line": 22, +"syntax_highlighter": "GDScript" +} + +[res://Scripts/ingame_ui.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 10, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 24, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://Scripts/varVar.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 4, +"scroll_position": 0.0, +"selection": true, +"selection_from_column": 0, +"selection_from_line": 4, +"selection_to_column": 17, +"selection_to_line": 5, +"syntax_highlighter": "GDScript" +} + +[res://Scripts/varConst.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 15, +"row": 0, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" diff --git a/Scenes/Cupcakes/cupcake.tscn b/Scenes/Cupcakes/cupcake.tscn index d5b6456..d51873a 100644 --- a/Scenes/Cupcakes/cupcake.tscn +++ b/Scenes/Cupcakes/cupcake.tscn @@ -22,3 +22,5 @@ texture = ExtResource("1_632he") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] scale = Vector2(2, 2) shape = SubResource("CircleShape2D_svirt") + +[connection signal="body_exited" from="." to="." method="_on_body_exited"] diff --git a/Scenes/UI/ingame_ui.tscn b/Scenes/UI/ingame_ui.tscn index ffe10f5..41168a1 100644 --- a/Scenes/UI/ingame_ui.tscn +++ b/Scenes/UI/ingame_ui.tscn @@ -1,14 +1,18 @@ -[gd_scene format=3 uid="uid://c4dtrk2kooa6q"] +[gd_scene load_steps=3 format=3 uid="uid://c4dtrk2kooa6q"] + +[ext_resource type="Script" path="res://Scripts/ingame_ui.gd" id="1_q8tnv"] +[ext_resource type="Texture2D" uid="uid://7fqro4fugv8k" path="res://Art/Cupcakes/Cupcake.png" id="1_vkoxt"] [node name="InGameUI" type="CanvasLayer"] +script = ExtResource("1_q8tnv") -[node name="Panel" type="Panel" parent="."] +[node name="Main" type="Panel" parent="."] offset_left = 16.0 offset_top = 997.0 offset_right = 1908.0 offset_bottom = 1066.0 -[node name="HBoxContainer" type="HBoxContainer" parent="Panel"] +[node name="HBoxContainer" type="HBoxContainer" parent="Main"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -16,10 +20,54 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="Van" type="Button" parent="Panel/HBoxContainer"] +[node name="Van" type="Button" parent="Main/HBoxContainer"] layout_mode = 2 -text = "Vanil" +icon = ExtResource("1_vkoxt") +icon_alignment = 1 -[node name="Choc" type="Button" parent="Panel/HBoxContainer"] +[node name="Choc" type="Button" parent="Main/HBoxContainer"] layout_mode = 2 text = "Choc" + +[node name="Num" type="Panel" parent="."] +clip_children = 1 +offset_left = 45.0 +offset_top = 15.0 +offset_right = 239.0 +offset_bottom = 985.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Num"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ccVanNum" type="Label" parent="Num/VBoxContainer"] +layout_mode = 2 +text = "0" + +[node name="Icons" type="Panel" parent="."] +clip_children = 1 +offset_left = 11.0 +offset_top = 15.0 +offset_right = 43.0 +offset_bottom = 985.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Icons"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ccVanIcon" type="Sprite2D" parent="Icons/VBoxContainer"] +position = Vector2(11, 0) +scale = Vector2(0.874, 0.874) +texture = ExtResource("1_vkoxt") +centered = false + +[connection signal="pressed" from="Main/HBoxContainer/Van" to="." method="_on_van_pressed"] +[connection signal="pressed" from="Main/HBoxContainer/Choc" to="." method="_on_choc_pressed"] diff --git a/Scenes/UI/upgrades.tscn b/Scenes/UI/upgrades.tscn index 0d00e63..801d033 100644 --- a/Scenes/UI/upgrades.tscn +++ b/Scenes/UI/upgrades.tscn @@ -1,6 +1,10 @@ -[gd_scene format=3 uid="uid://cpv7y67qtmino"] +[gd_scene load_steps=3 format=3 uid="uid://cpv7y67qtmino"] + +[ext_resource type="Script" path="res://Scripts/upgrades.gd" id="1_ofi8s"] +[ext_resource type="Texture2D" uid="uid://7fqro4fugv8k" path="res://Art/Cupcakes/Cupcake.png" id="2_c66ch"] [node name="Upgrades" type="CanvasLayer"] +script = ExtResource("1_ofi8s") [node name="Anim" type="AnimationPlayer" parent="."] @@ -49,6 +53,94 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +vertical_scroll_mode = 2 + +[node name="VanGrid" type="GridContainer" parent="Control/ScrollContainer"] +custom_minimum_size = Vector2(64, 64) +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="VanUp1" type="HBoxContainer" parent="Control/ScrollContainer/VanGrid"] +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="Control/ScrollContainer/VanGrid/VanUp1"] +layout_mode = 2 +texture = ExtResource("2_c66ch") + +[node name="Name" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp1"] +layout_mode = 2 +text = "More Cupcakes" + +[node name="Desc" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp1"] +layout_mode = 2 +text = "+1 cupcake per drop" + +[node name="Price" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp1"] +layout_mode = 2 +text = "10" + +[node name="Buy" type="Button" parent="Control/ScrollContainer/VanGrid/VanUp1"] +layout_mode = 2 +text = "Buy" + +[node name="VanUp2" type="HBoxContainer" parent="Control/ScrollContainer/VanGrid"] +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="Control/ScrollContainer/VanGrid/VanUp2"] +layout_mode = 2 +texture = ExtResource("2_c66ch") + +[node name="Name" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp2"] +layout_mode = 2 +text = "Faster Cupcakes" + +[node name="Desc" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp2"] +layout_mode = 2 +text = "+1% faster cupcake droprate" + +[node name="Price" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp2"] +layout_mode = 2 +text = "15" + +[node name="Buy" type="Button" parent="Control/ScrollContainer/VanGrid/VanUp2"] +layout_mode = 2 +text = "Buy" + +[node name="VanUp3" type="HBoxContainer" parent="Control/ScrollContainer/VanGrid"] +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="Control/ScrollContainer/VanGrid/VanUp3"] +layout_mode = 2 +texture = ExtResource("2_c66ch") + +[node name="Name" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp3"] +layout_mode = 2 +text = "Condensed Cupcakes" + +[node name="Desc" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp3"] +layout_mode = 2 +text = "+1 cupcake for every cupcake collected" -[node name="VBoxContainer" type="VBoxContainer" parent="Control/ScrollContainer"] +[node name="Price" type="Label" parent="Control/ScrollContainer/VanGrid/VanUp3"] layout_mode = 2 +text = "15" + +[node name="Buy" type="Button" parent="Control/ScrollContainer/VanGrid/VanUp3"] +layout_mode = 2 +text = "Buy" + +[node name="VScrollBar" type="VScrollBar" parent="Control"] +layout_mode = 2 +anchor_left = 1.0 +anchor_top = 0.033 +anchor_right = 1.021 +anchor_bottom = 0.989 +offset_left = 8.0 +offset_top = -0.046999 +offset_right = -0.20105 +offset_bottom = 0.348999 + +[connection signal="pressed" from="Close" to="." method="_on_close_pressed"] +[connection signal="pressed" from="Control/ScrollContainer/VanGrid/VanUp1/Buy" to="." method="_on_buy_pressed"] +[connection signal="pressed" from="Control/ScrollContainer/VanGrid/VanUp2/Buy" to="." method="_on_buy_van2_pressed"] +[connection signal="pressed" from="Control/ScrollContainer/VanGrid/VanUp3/Buy" to="." method="_on_buy_van3_pressed"] diff --git a/Scenes/game_world.tscn b/Scenes/game_world.tscn index d823dcd..985dc32 100644 --- a/Scenes/game_world.tscn +++ b/Scenes/game_world.tscn @@ -1,35 +1,51 @@ -[gd_scene load_steps=6 format=3 uid="uid://dlypem0porccr"] +[gd_scene load_steps=8 format=3 uid="uid://dlypem0porccr"] [ext_resource type="Script" path="res://Scripts/game_world.gd" id="1_c2sx0"] [ext_resource type="Script" path="res://Scripts/Cupcake Spawn Timer.gd" id="2_bjylp"] [ext_resource type="PackedScene" uid="uid://dswkgkor3yejo" path="res://Scenes/Cupcakes/cupcake.tscn" id="2_fi3r2"] +[ext_resource type="PackedScene" uid="uid://cpv7y67qtmino" path="res://Scenes/UI/upgrades.tscn" id="2_vdy4r"] [ext_resource type="Script" path="res://Scripts/PlayArea.gd" id="3_3x1i6"] +[ext_resource type="PackedScene" uid="uid://c4dtrk2kooa6q" path="res://Scenes/UI/ingame_ui.tscn" id="3_wm6l6"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_sh03e"] -size = Vector2(1943, 1102) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_g5fj2"] +size = Vector2(1841, 1003) [node name="GameWorld" type="Node2D"] script = ExtResource("1_c2sx0") [node name="Location" type="Node2D" parent="."] +[node name="Upgrades" parent="." instance=ExtResource("2_vdy4r")] +visible = false + +[node name="InGameUI" parent="." instance=ExtResource("3_wm6l6")] + [node name="Cupcake Spawn Timer" type="Timer" parent="."] -wait_time = 2.0 +wait_time = 5.0 autostart = true script = ExtResource("2_bjylp") +[node name="Cupcakes" type="Node2D" parent="."] + +[node name="Cupcake" parent="Cupcakes" instance=ExtResource("2_fi3r2")] +position = Vector2(283, -176) + [node name="PlayArea" type="Area2D" parent="."] +light_mask = 3 +visibility_layer = 3 +collision_layer = 3 +collision_mask = 3 script = ExtResource("3_3x1i6") -[node name="Cupcake" parent="PlayArea" instance=ExtResource("2_fi3r2")] -position = Vector2(83, -168) -collision_layer = 1 - [node name="CollisionShape2D" type="CollisionShape2D" parent="PlayArea"] -position = Vector2(961.5, 541) -shape = SubResource("RectangleShape2D_sh03e") +position = Vector2(961.5, 533.5) +shape = SubResource("RectangleShape2D_g5fj2") +[connection signal="condensedCupcake1" from="." to="Cupcakes/Cupcake" method="_on_game_world_condensed_cupcake_1"] +[connection signal="condensedCupcake1" from="Upgrades" to="." method="_on_upgrades_condensed_cupcake_1"] +[connection signal="fasterCupcake" from="Upgrades" to="." method="_on_upgrades_faster_cupcake"] +[connection signal="oneMoreCupcake" from="Upgrades" to="." method="_on_upgrades_one_more_cupcake"] [connection signal="timeout" from="Cupcake Spawn Timer" to="." method="_on_timeout"] -[connection signal="area_exited" from="PlayArea" to="." method="_on_play_area_area_exited"] -[connection signal="area_exited" from="PlayArea" to="PlayArea" method="_on_area_exited"] +[connection signal="ccVanCollected" from="Cupcakes/Cupcake" to="." method="_on_cupcake_cc_van_collected"] [connection signal="body_exited" from="PlayArea" to="." method="_on_play_area_body_exited"] +[connection signal="body_exited" from="PlayArea" to="Cupcakes/Cupcake" method="_on_play_area_body_exited"] diff --git a/Scripts/Cupcakes/cupcake.gd b/Scripts/Cupcakes/cupcake.gd index 3ad452b..e860ecf 100644 --- a/Scripts/Cupcakes/cupcake.gd +++ b/Scripts/Cupcakes/cupcake.gd @@ -2,6 +2,11 @@ extends RigidBody2D var speed = Vector2.ZERO var horse = preload("res://Scripts/horse.gd") +@onready var playArea = $"../../PlayArea" +@onready var ccCol +var scorecard = preload("res://Scripts/varVar.gd") +var ccValue = 1 +signal ccVanCollected() func _ready(): pass # Replace with function body. @@ -12,3 +17,13 @@ func _process(delta): pass +func _on_play_area_body_exited(body): + if body.get_parent() == $"../../Cupcakes": + emit_signal("ccVanCollected") + body.queue_free() + + + + +func _on_game_world_condensed_cupcake_1(): + ccValue += 1 diff --git a/Scripts/PlayArea.gd b/Scripts/PlayArea.gd index 6ea836c..1f38694 100644 --- a/Scripts/PlayArea.gd +++ b/Scripts/PlayArea.gd @@ -11,8 +11,3 @@ func _process(delta): pass -func _on_area_exited(body): - if body.is_in_group("Cupcake"): - horse.ccVanNum += 1 - print(horse.ccVanNum) - body.queue_free() diff --git a/Scripts/game_world.gd b/Scripts/game_world.gd index cac1848..639da0d 100644 --- a/Scripts/game_world.gd +++ b/Scripts/game_world.gd @@ -1,18 +1,32 @@ extends Node2D -var inGameUI = preload("res://Scenes/UI/ingame_ui.tscn") +signal condensedCupcake1() + +#Cupcake Values +var ccVanNum: int = 0 +var ccChocNum: int = 0 + +#Cupcake Prices +var ccVanPrice: int = 10 +var ccVanPrice2: int = 15 +var ccVanPrice3: int = 15 +var ccChocPrice: int = 10 + +#Preloaded scenes and scripts var upgradeUI = preload("res://Scenes/UI/upgrades.tscn") var location = preload("res://Scenes/Locations/yard.tscn") var horse_scene = preload("res://Scenes/horse.tscn") var horse = preload("res://Scripts/horse.gd") -var horse_instance -var IGUI -var mouse_position = Vector2.ZERO var ccVanilla = preload("res://Scenes/Cupcakes/cupcake.tscn") -var ccvan = ccVanilla.instantiate() var ccChocolate var ccchoc -var ccSpawnRate = 25 + +#Other +var horseAttached = true +var horse_instance +var mouse_position = Vector2.ZERO +var ccvan = ccVanilla.instantiate() +var ccSpawnRate = 3 var ccCount = 0 var ccMaxOnScreen = 2000 @@ -20,16 +34,24 @@ func _ready(): var spawn horse_instance = horse_scene.instantiate() spawn = location.instantiate() - IGUI = inGameUI.instantiate() $Location.add_child(spawn) add_child(horse_instance) - add_child(IGUI) func _process(delta): - mouse_position = get_global_mouse_position() - horse_instance.position = mouse_position + if horseAttached == true: + mouse_position = get_global_mouse_position() + horse_instance.position = mouse_position + handleInput() +func handleInput(): + if Input.is_action_pressed("horseAttach"): + if horseAttached == true: + horseAttached = false + else: + horseAttached = true + + func spawnCupcakes(): var randX var randY @@ -39,19 +61,50 @@ func spawnCupcakes(): randX = randi_range(10, 1910) randY = randi_range(10, 1070) ccvan.position = Vector2(randX, randY) - $PlayArea.add_child(ccvan.duplicate()) - ccCount = ccCount + 25 + $Cupcakes.add_child(ccvan.duplicate()) + ccCount = ccCount + ccSpawnRate func collectCupcakes(): - pass + $InGameUI/Num/VBoxContainer/ccVanNum.text = str(ccVanNum) func _on_timeout(): var timer = get_node("Cupcake Spawn Timer") spawnCupcakes() + collectCupcakes() timer.start + func _on_play_area_body_exited(body): pass + +func _on_cupcake_cc_van_collected(): + ccVanNum += 1 + ccCount -= 1 + collectCupcakes() + + +func _on_upgrades_one_more_cupcake(): + if ccVanNum >= ccVanPrice: + ccSpawnRate += 1 + ccVanNum -= ccVanPrice + ccVanPrice = ccVanPrice * 2 + $Upgrades/Control/ScrollContainer/VanGrid/VanUp1/Price.text = str(ccVanPrice) + collectCupcakes() + + +func _on_upgrades_faster_cupcake(): + pass # Replace with function body. + + +func _on_upgrades_condensed_cupcake(): + pass + +func _on_upgrades_condensed_cupcake_1(): + if ccVanNum >= ccVanPrice3: + ccVanNum -= ccVanPrice3 + ccVanPrice2 = ccVanPrice3 * 2 + emit_signal("condensedCupcakes1") + $Upgrades/Control/ScrollContainer/VanGrid/VanUp3/Price.text = str(ccVanPrice3) diff --git a/Scripts/ingame_ui.gd b/Scripts/ingame_ui.gd new file mode 100644 index 0000000..25a9b58 --- /dev/null +++ b/Scripts/ingame_ui.gd @@ -0,0 +1,25 @@ +extends CanvasLayer + +@onready var upgrades = $"../Upgrades" + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_van_pressed(): + if upgrades.visible == false: + upgrades.visible = true + else: + upgrades.visible = false + +func _on_choc_pressed(): + if upgrades.visible == false: + upgrades.visible = true + else: + upgrades.visible = false diff --git a/Scripts/upgrades.gd b/Scripts/upgrades.gd new file mode 100644 index 0000000..f177703 --- /dev/null +++ b/Scripts/upgrades.gd @@ -0,0 +1,28 @@ +extends CanvasLayer + +signal oneMoreCupcake() +signal fasterCupcake() +signal condensedCupcake1() + + + + +func _ready(): + pass # Replace with function body. + + +func _on_close_pressed(): + self.visible = false + + + +func _on_buy_pressed(): + emit_signal("oneMoreCupcake") + + +func _on_buy_van2_pressed(): + emit_signal("fasterCupcake") + + +func _on_buy_van3_pressed(): + emit_signal("condensedCupcake1") diff --git a/Scripts/varVar.gd b/Scripts/varVar.gd index e08925d..f870c53 100644 --- a/Scripts/varVar.gd +++ b/Scripts/varVar.gd @@ -1,11 +1,6 @@ extends Node +var location -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass +var ccVanNum = 0 +var ccChocNum = 0 diff --git a/export_presets.cfg b/export_presets.cfg index e69de29..2d76d8a 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -0,0 +1,41 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_script=1 +binary_format/embed_pck=false +texture_format/bptc=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false +texture_format/no_bptc_fallbacks=true +binary_format/architecture="x86_64" +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="#!/usr/bin/env bash +export DISPLAY=:0 +unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" +\"{temp_dir}/{exe_name}\" {cmd_args}" +ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash +kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") +rm -rf \"{temp_dir}\"" diff --git a/project.godot b/project.godot index d56c08d..920f387 100644 --- a/project.godot +++ b/project.godot @@ -24,3 +24,11 @@ window/stretch/mode="viewport" version_control/plugin_name="GitPlugin" version_control/autoload_on_startup=true + +[input] + +horseAttach={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null) +] +}