mirror of
https://github.com/Steffo99/particle-clash.git
synced 2024-11-21 15:14:19 +00:00
Create main menu
This commit is contained in:
parent
f4ac2a2723
commit
1fce7cb55b
14 changed files with 253 additions and 69 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"files.exclude": {
|
||||
"**/.import": true
|
||||
"**/.import": true,
|
||||
"**/*.tscn": true
|
||||
},
|
||||
"editor.insertSpaces": false,
|
||||
"editor.renderWhitespace": "all"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
22
src/Main.gd
Normal file
22
src/Main.gd
Normal file
|
@ -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()
|
39
src/Main.tscn
Normal file
39
src/Main.tscn
Normal file
|
@ -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"]
|
|
@ -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()
|
|
@ -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"]
|
|
@ -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
|
||||
|
|
7
src/scenes/Gameplay.gd
Normal file
7
src/scenes/Gameplay.gd
Normal file
|
@ -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)
|
45
src/scenes/Gameplay.tscn
Normal file
45
src/scenes/Gameplay.tscn
Normal file
|
@ -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"]
|
122
src/scenes/Menu.tscn
Normal file
122
src/scenes/Menu.tscn
Normal file
|
@ -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!"
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
|
@ -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 )
|
||||
|
|
BIN
src/sprites/background.png
(Stored with Git LFS)
BIN
src/sprites/background.png
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue