Title screen and fixed controller issues

main
Martin Felis 2024-01-28 00:17:29 +01:00
parent c467182087
commit e1ec72e83e
4 changed files with 137 additions and 22 deletions

View File

@ -37,37 +37,37 @@ ui_cancel={
}
move_up_p1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":118,"echo":false,"script":null)
]
}
move_down_p1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":105,"echo":false,"script":null)
]
}
move_left_p1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":117,"echo":false,"script":null)
]
}
move_right_p1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
dash_p1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":79,"key_label":0,"unicode":102,"echo":false,"script":null)
]
}
bomb_p1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":113,"echo":false,"script":null)
]
}
@ -87,24 +87,32 @@ move_down_p2={
}
move_left_p2={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":0,"axis_value":-1.0,"script":null)
]
}
move_right_p2={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":0,"axis_value":1.0,"script":null)
]
}
dash_p2={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194440,"key_label":0,"unicode":50,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
]
}
bomb_p2={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194441,"key_label":0,"unicode":51,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
]
}
move={
"deadzone": 0.5,
"events": []
}
[layer_names]

View File

@ -60,7 +60,6 @@ script = ExtResource("4_2tdl1")
world_path = NodePath("../Viewport/World")
[node name="GameStartupWidgets" type="Panel" parent="GameUI"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@ -71,20 +70,86 @@ theme = ExtResource("2_eun58")
[node name="Label" type="Label" parent="GameUI/GameStartupWidgets"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -149.0
offset_top = -128.0
offset_right = 149.0
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/font_size = 120
text = "Ready?"
horizontal_alignment = 1
[node name="Logo" type="Control" parent="GameUI/GameStartupWidgets"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -27.5
offset_top = -11.5
offset_right = 27.5
offset_bottom = 11.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 120
text = "Ready?"
horizontal_alignment = 1
[node name="Label2" type="Label" parent="GameUI/GameStartupWidgets/Logo"]
layout_mode = 0
offset_left = -356.0
offset_top = -160.871
offset_right = -34.0
offset_bottom = 10.1293
rotation = -0.277231
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 20
theme_override_constants/shadow_offset_y = 20
theme_override_constants/outline_size = 40
theme_override_font_sizes/font_size = 160
text = "CLASH"
[node name="Label3" type="Label" parent="GameUI/GameStartupWidgets/Logo"]
offset_left = -142.0
offset_top = -107.871
offset_right = 182.0
offset_bottom = 63.1293
rotation = -0.279149
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 20
theme_override_constants/shadow_offset_y = 20
theme_override_constants/outline_size = 40
theme_override_font_sizes/font_size = 160
text = "BOOM"
[node name="Label4" type="Label" parent="GameUI/GameStartupWidgets/Logo"]
offset_left = -219.0
offset_top = 12.1293
offset_right = 120.0
offset_bottom = 183.129
rotation = -0.137962
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 20
theme_override_constants/shadow_offset_y = 20
theme_override_constants/outline_size = 40
theme_override_font_sizes/font_size = 160
text = "COLOR"
[node name="Label5" type="Label" parent="GameUI/GameStartupWidgets/Logo"]
offset_left = -34.0
offset_top = 97.0
offset_right = 305.0
offset_bottom = 268.0
rotation = -0.155661
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 20
theme_override_constants/shadow_offset_y = 20
theme_override_constants/outline_size = 40
theme_override_font_sizes/font_size = 160
text = "CLASH"
[node name="GameFinishedWidgets" type="Panel" parent="GameUI"]
visible = false
@ -96,24 +161,62 @@ grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("2_eun58")
[node name="Label" type="Label" parent="GameUI/GameFinishedWidgets"]
[node name="VBoxContainer" type="VBoxContainer" parent="GameUI/GameFinishedWidgets"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -27.5
offset_top = -11.5
offset_right = 27.5
offset_bottom = 11.5
offset_left = -240.0
offset_top = -64.0
offset_right = 240.0
offset_bottom = 64.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="GameUI/GameFinishedWidgets/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 120
text = "Game Over!"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="GameUI/GameFinishedWidgets/VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Player1Stats" type="VBoxContainer" parent="GameUI/GameFinishedWidgets/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(200, 0)
layout_direction = 2
layout_mode = 2
[node name="Label" type="Label" parent="GameUI/GameFinishedWidgets/VBoxContainer/HBoxContainer/Player1Stats"]
layout_mode = 2
text = "Player 1"
horizontal_alignment = 1
[node name="Points" type="Label" parent="GameUI/GameFinishedWidgets/VBoxContainer/HBoxContainer/Player1Stats"]
layout_mode = 2
text = "0"
horizontal_alignment = 1
[node name="Player2Stats" type="VBoxContainer" parent="GameUI/GameFinishedWidgets/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(200, 0)
layout_direction = 2
layout_mode = 2
[node name="Label" type="Label" parent="GameUI/GameFinishedWidgets/VBoxContainer/HBoxContainer/Player2Stats"]
layout_mode = 2
text = "Player 2"
horizontal_alignment = 1
[node name="Points" type="Label" parent="GameUI/GameFinishedWidgets/VBoxContainer/HBoxContainer/Player2Stats"]
layout_mode = 2
text = "0"
horizontal_alignment = 1
[node name="GameRunningWidgets" type="Panel" parent="GameUI"]
visible = false
custom_minimum_size = Vector2(0, 80)
layout_mode = 1
anchors_preset = 10
@ -160,7 +263,6 @@ text = "0
[node name="EnergyProgressBar" type="ProgressBar" parent="GameUI/GameRunningWidgets/Player2Widgets"]
custom_minimum_size = Vector2(400, 0)
layout_direction = 2
layout_mode = 2
value = 75.0

View File

@ -14,6 +14,9 @@ extends Control
@onready var time_left_label : Label = $'GameRunningWidgets/TimeWidgets/TimeLeftLabel'
@onready var player1_stats_points : Label = $'GameFinishedWidgets/VBoxContainer/HBoxContainer/Player1Stats/Points'
@onready var player2_stats_points : Label = $'GameFinishedWidgets/VBoxContainer/HBoxContainer/Player2Stats/Points'
var world : World = null
# Called when the node enters the scene tree for the first time.
@ -45,10 +48,12 @@ func _process(_delta):
player1_score_label.text = str(world.players[0].score)
player1_energy_progressbar.value = world.players[0].energy
player1_stats_points.text = str(world.players[0].score)
if player2_widgets.visible:
player2_score_label.text = str(world.players[1].score)
player2_energy_progressbar.value = world.players[1].energy
player2_stats_points.text = str(world.players[1].score)
func _input(event):
if event.is_action_pressed("ui_accept"):

View File

@ -9,7 +9,7 @@ class_name World extends Node3D
@onready var level: Node3D = $Level
@onready var world_coloring_viewport: SubViewport = $WorldColoringViewport
const GAME_DURATION_SECONDS = 10
const GAME_DURATION_SECONDS = 20
var camera_position: Vector3;
var world_coloring_material: ShaderMaterial