diff --git a/.vscode/settings.json b/.vscode/settings.json index d7b46dd..5ba82c4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "files.exclude": { - "**/.import": true + "**/.import": true, + "**/*.tscn": true }, "editor.insertSpaces": false, "editor.renderWhitespace": "all" diff --git a/project.godot b/project.godot index fbb3e6b..bcefda1 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=4 [application] config/name="Atomic Fusion" -run/main_scene="res://src/MainMenu.tscn" +run/main_scene="res://src/Main.tscn" boot_splash/show_image=false config/icon="res://src/sprites/atom.png" diff --git a/src/Main.gd b/src/Main.gd new file mode 100644 index 0000000..035b9bd --- /dev/null +++ b/src/Main.gd @@ -0,0 +1,22 @@ +extends Node2D + +func _on_LeftColorPicker_color_changed(color: Color): + $Background/Left.modulate = color + $Gameplay/LeftPlayArea.self_modulate = color + $Gameplay/LeftPlayArea/Tiles.self_modulate = color + $Gameplay/Minimap/Left.self_modulate = color + +func _on_RightColorPicker_color_changed(color: Color): + $Background/Right.modulate = color + $Gameplay/RightPlayArea.self_modulate = color + $Gameplay/RightPlayArea/Tiles.self_modulate = color + $Gameplay/Minimap/Right.self_modulate = color + +func _on_Button_button_up(): + $Menu.visible = false + $Gameplay.visible = true + $Gameplay/LeftPlayArea.tiles_init() + $Gameplay/LeftPlayArea.cursor_init() + $Gameplay/RightPlayArea.tiles_init() + $Gameplay/RightPlayArea.cursor_init() + $Gameplay/Timer.start() diff --git a/src/Main.tscn b/src/Main.tscn new file mode 100644 index 0000000..34478e9 --- /dev/null +++ b/src/Main.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://src/scenes/Menu.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/scenes/Gameplay.tscn" type="PackedScene" id=2] +[ext_resource path="res://src/scenes/Background.tscn" type="PackedScene" id=3] +[ext_resource path="res://src/Main.gd" type="Script" id=5] + +[node name="Main" type="Node2D"] +script = ExtResource( 5 ) + +[node name="Background" parent="." instance=ExtResource( 3 )] +position = Vector2( 800, 450 ) + +[node name="Menu" parent="." instance=ExtResource( 1 )] + +[node name="ColorPicker" parent="Menu/VBoxContainer/Colors/Left Player" index="1"] +margin_left = 0.0 +margin_top = 34.0 +margin_right = 420.0 +margin_bottom = 508.0 + +[node name="ColorPicker" parent="Menu/VBoxContainer/Colors/Right Player" index="1"] +margin_left = 0.0 +margin_top = 34.0 +margin_right = 420.0 +margin_bottom = 508.0 + +[node name="Gameplay" parent="." instance=ExtResource( 2 )] +visible = false + +[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Left Player/ColorPicker" to="." method="_on_LeftColorPicker_color_changed"] +[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Right Player/ColorPicker" to="." method="_on_RightColorPicker_color_changed"] +[connection signal="button_up" from="Menu/VBoxContainer/Button" to="." method="_on_Button_button_up"] + +[editable path="Background"] +[editable path="Menu"] +[editable path="Gameplay"] +[editable path="Gameplay/LeftPlayArea"] +[editable path="Gameplay/RightPlayArea"] diff --git a/src/MainMenu.gd b/src/MainMenu.gd deleted file mode 100644 index 9444470..0000000 --- a/src/MainMenu.gd +++ /dev/null @@ -1,11 +0,0 @@ -extends Node2D - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready(): - $Timer.start() diff --git a/src/MainMenu.tscn b/src/MainMenu.tscn deleted file mode 100644 index a5ed95f..0000000 --- a/src/MainMenu.tscn +++ /dev/null @@ -1,25 +0,0 @@ -[gd_scene load_steps=5 format=2] - -[ext_resource path="res://src/MainMenu.gd" type="Script" id=1] -[ext_resource path="res://src/scenes/Background.tscn" type="PackedScene" id=2] -[ext_resource path="res://src/scenes/Play Area.tscn" type="PackedScene" id=3] -[ext_resource path="res://src/scenes/Timer.tscn" type="PackedScene" id=5] - -[node name="MainMenu" type="Node2D"] -script = ExtResource( 1 ) - -[node name="Background" parent="." instance=ExtResource( 2 )] -modulate = Color( 0, 0.31, 0, 1 ) - -[node name="Left Play Area" parent="." instance=ExtResource( 3 )] -position = Vector2( 400, 450 ) -player = "p1" - -[node name="Right Play Area" parent="." instance=ExtResource( 3 )] -position = Vector2( 1200, 450 ) -player = "p2" - -[node name="Timer" parent="." instance=ExtResource( 5 )] - -[editable path="Left Play Area"] -[editable path="Right Play Area"] diff --git a/src/scenes/Background.tscn b/src/scenes/Background.tscn index 90fb071..09364f7 100644 --- a/src/scenes/Background.tscn +++ b/src/scenes/Background.tscn @@ -2,6 +2,16 @@ [ext_resource path="res://src/sprites/background.png" type="Texture" id=1] -[node name="Background" type="Sprite"] -position = Vector2( 800, 450 ) +[node name="Background" type="Node2D"] +modulate = Color( 0.117647, 0.117647, 0.117647, 1 ) + +[node name="Left" type="Sprite" parent="."] +modulate = Color( 1, 0.701961, 0.701961, 1 ) +position = Vector2( -400, 0 ) texture = ExtResource( 1 ) + +[node name="Right" type="Sprite" parent="."] +modulate = Color( 0.701961, 0.701961, 1, 1 ) +position = Vector2( 400, 0 ) +texture = ExtResource( 1 ) +flip_h = true diff --git a/src/scenes/Gameplay.gd b/src/scenes/Gameplay.gd new file mode 100644 index 0000000..db3c494 --- /dev/null +++ b/src/scenes/Gameplay.gd @@ -0,0 +1,7 @@ +extends Node2D + + +func _process(_delta): + var timer = $Timer + $Minimap/Left.position.x = (1 - timer.time_left / timer.wait_time) * (get_viewport().size.x / 2) + $Minimap/Right.position.x = get_viewport().size.x - (1 - timer.time_left / timer.wait_time) * (get_viewport().size.x / 2) diff --git a/src/scenes/Gameplay.tscn b/src/scenes/Gameplay.tscn new file mode 100644 index 0000000..641b2ca --- /dev/null +++ b/src/scenes/Gameplay.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://src/scenes/Gameplay.gd" type="Script" id=1] +[ext_resource path="res://src/sprites/atom.png" type="Texture" id=2] +[ext_resource path="res://src/scenes/Play Area.tscn" type="PackedScene" id=6] +[ext_resource path="res://src/scenes/Timer.tscn" type="PackedScene" id=7] + +[node name="Gameplay" type="Node2D"] +script = ExtResource( 1 ) + +[node name="LeftPlayArea" parent="." instance=ExtResource( 6 )] +self_modulate = Color( 1, 0.701961, 0.701961, 1 ) +position = Vector2( 400, 450 ) +player = "p1" + +[node name="Tiles" parent="LeftPlayArea" index="1"] +self_modulate = Color( 1, 0.701961, 0.701961, 1 ) + +[node name="RightPlayArea" parent="." instance=ExtResource( 6 )] +self_modulate = Color( 0.701961, 0.701961, 1, 1 ) +position = Vector2( 1200, 450 ) +player = "p2" + +[node name="Tiles" parent="RightPlayArea" index="1"] +self_modulate = Color( 0.701961, 0.701961, 1, 1 ) + +[node name="Timer" parent="." instance=ExtResource( 7 )] +one_shot = true + +[node name="Minimap" type="Node2D" parent="."] +position = Vector2( 0, 16 ) + +[node name="Left" type="Sprite" parent="Minimap"] +self_modulate = Color( 1, 0.7, 0.7, 1 ) +scale = Vector2( 0.5, 0.5 ) +texture = ExtResource( 2 ) + +[node name="Right" type="Sprite" parent="Minimap"] +self_modulate = Color( 0.7, 0.7, 1, 1 ) +position = Vector2( 1600, 0 ) +scale = Vector2( 0.5, 0.5 ) +texture = ExtResource( 2 ) + +[editable path="LeftPlayArea"] +[editable path="RightPlayArea"] diff --git a/src/scenes/Menu.tscn b/src/scenes/Menu.tscn new file mode 100644 index 0000000..4129de4 --- /dev/null +++ b/src/scenes/Menu.tscn @@ -0,0 +1,122 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://src/fonts/Xolonium-Bold.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://src/fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2] + +[sub_resource type="DynamicFont" id=1] +size = 24 +font_data = ExtResource( 2 ) + +[sub_resource type="Theme" id=2] +default_font = SubResource( 1 ) + +[sub_resource type="DynamicFont" id=3] +size = 48 +font_data = ExtResource( 1 ) + +[node name="Menu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 1600.0 +margin_bottom = 900.0 +theme = SubResource( 2 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +alignment = 1 + +[node name="Title" type="Label" parent="VBoxContainer"] +margin_top = 95.0 +margin_right = 1600.0 +margin_bottom = 153.0 +custom_fonts/font = SubResource( 3 ) +text = "Atomic Clash" +align = 1 + +[node name="Padding" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 157.0 +margin_right = 1600.0 +margin_bottom = 197.0 +rect_min_size = Vector2( 0, 40 ) + +[node name="Colors" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 201.0 +margin_right = 1600.0 +margin_bottom = 709.0 +alignment = 1 + +[node name="Left Player" type="VBoxContainer" parent="VBoxContainer/Colors"] +margin_left = 304.0 +margin_right = 724.0 +margin_bottom = 508.0 +alignment = 1 + +[node name="Label" type="Label" parent="VBoxContainer/Colors/Left Player"] +margin_right = 420.0 +margin_bottom = 30.0 +text = "Left Player [WASD + Space]" + +[node name="ColorPicker" type="ColorPicker" parent="VBoxContainer/Colors/Left Player"] +margin_left = 4.0 +margin_top = 38.0 +margin_right = 424.0 +margin_bottom = 512.0 +color = Color( 1, 0.7, 0.7, 1 ) +edit_alpha = false +hsv_mode = true +presets_enabled = false +presets_visible = false + +[node name="Vs" type="VBoxContainer" parent="VBoxContainer/Colors"] +margin_left = 728.0 +margin_right = 872.0 +margin_bottom = 508.0 +rect_min_size = Vector2( 144, 0 ) +alignment = 1 + +[node name="Label" type="Label" parent="VBoxContainer/Colors/Vs"] +margin_top = 239.0 +margin_right = 144.0 +margin_bottom = 269.0 +text = "VS" +align = 1 +valign = 1 + +[node name="Right Player" type="VBoxContainer" parent="VBoxContainer/Colors"] +margin_left = 876.0 +margin_right = 1296.0 +margin_bottom = 508.0 +alignment = 1 + +[node name="Label" type="Label" parent="VBoxContainer/Colors/Right Player"] +margin_right = 420.0 +margin_bottom = 30.0 +text = "[↑←↓→ + Enter] Right Player" +align = 2 + +[node name="ColorPicker" type="ColorPicker" parent="VBoxContainer/Colors/Right Player"] +margin_left = 4.0 +margin_top = 38.0 +margin_right = 424.0 +margin_bottom = 512.0 +color = Color( 0.7, 0.7, 1, 1 ) +edit_alpha = false +hsv_mode = true +presets_enabled = false +presets_visible = false + +[node name="Padding2" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 713.0 +margin_right = 1600.0 +margin_bottom = 753.0 +rect_min_size = Vector2( 0, 40 ) + +[node name="Button" type="Button" parent="VBoxContainer"] +margin_left = 720.0 +margin_top = 757.0 +margin_right = 880.0 +margin_bottom = 805.0 +rect_min_size = Vector2( 160, 48 ) +size_flags_horizontal = 4 +text = "Start!" diff --git a/src/scenes/Play Area.gd b/src/scenes/Play Area.gd index e8f29ec..8d0a24c 100644 --- a/src/scenes/Play Area.gd +++ b/src/scenes/Play Area.gd @@ -161,8 +161,3 @@ func _process(_delta): cursor_left() if Input.is_action_just_pressed(player + "_rotate"): cursor_rotate() - - -func _ready(): - tiles_init() - cursor_init() diff --git a/src/scenes/Timer.gd b/src/scenes/Timer.gd deleted file mode 100644 index 1964941..0000000 --- a/src/scenes/Timer.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends Timer - - -func _process(_delta): - $Minimap/Left.position.x = (1 - time_left / wait_time) * (get_viewport().size.x / 2) - $Minimap/Right.position.x = get_viewport().size.x - (1 - time_left / wait_time) * (get_viewport().size.x / 2) diff --git a/src/scenes/Timer.tscn b/src/scenes/Timer.tscn index 0b5cef8..650e8f5 100644 --- a/src/scenes/Timer.tscn +++ b/src/scenes/Timer.tscn @@ -1,15 +1,12 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://src/music/2-atoms-sine.ogg" type="AudioStream" id=1] [ext_resource path="res://src/music/2-atoms-square.ogg" type="AudioStream" id=2] [ext_resource path="res://src/music/2-atoms-saw.ogg" type="AudioStream" id=3] [ext_resource path="res://src/music/2-atoms-base.ogg" type="AudioStream" id=4] -[ext_resource path="res://src/sprites/atom.png" type="Texture" id=5] -[ext_resource path="res://src/scenes/Timer.gd" type="Script" id=6] [node name="Timer" type="Timer"] wait_time = 10.0 -script = ExtResource( 6 ) [node name="AudioBase" type="AudioStreamPlayer" parent="."] stream = ExtResource( 4 ) @@ -22,15 +19,3 @@ stream = ExtResource( 2 ) [node name="AudioSaw" type="AudioStreamPlayer" parent="."] stream = ExtResource( 3 ) - -[node name="Minimap" type="Node2D" parent="."] -position = Vector2( 0, 16 ) - -[node name="Left" type="Sprite" parent="Minimap"] -scale = Vector2( 0.5, 0.5 ) -texture = ExtResource( 5 ) - -[node name="Right" type="Sprite" parent="Minimap"] -position = Vector2( 1600, 0 ) -scale = Vector2( 0.5, 0.5 ) -texture = ExtResource( 5 ) diff --git a/src/sprites/background.png b/src/sprites/background.png index 6ff3de5..8a01b1c 100644 --- a/src/sprites/background.png +++ b/src/sprites/background.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a634c42be3d0862aeb9bc25b6cbbda466e3058a0be2efe9515320394bd92365 -size 966049 +oid sha256:a0e00dbfb7a365c4452980264c446040113296968edb12c205f2952cad8ef17d +size 489534