Reworked weapons and projectiles
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
extends Control
|
||||
|
||||
|
||||
signal show_main_menu
|
||||
|
||||
|
||||
@onready var main_menu_button : Button = $%MainMenuButton
|
||||
@onready var button_focus_timer : Timer = $ButtonFocusTimer
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
main_menu_button.grab_focus()
|
||||
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if visible and button_focus_timer:
|
||||
button_focus_timer.start()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bkj8s7588e1ho
|
||||
@@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://duxm8n62j2qt6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bkj8s7588e1ho" path="res://game/menu/ingame/game_over_screen.gd" id="1_rkkr6"]
|
||||
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_uh3ar"]
|
||||
|
||||
[node name="GameOverScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_rkkr6")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"]
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
text = "Game Over"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_uh3ar")
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="ButtonFocusTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="CenterContainer/VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="timeout" from="ButtonFocusTimer" to="." method="_on_timer_timeout"]
|
||||
@@ -0,0 +1,44 @@
|
||||
extends Control
|
||||
|
||||
|
||||
signal continue_game
|
||||
signal show_main_menu
|
||||
signal show_options
|
||||
|
||||
|
||||
@onready var continue_button := $%ContinueButton
|
||||
@onready var main_menu_button := $%MainMenuButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _init_focus() -> void:
|
||||
continue_button.grab_focus()
|
||||
|
||||
|
||||
func _setup_neighbors() -> void:
|
||||
continue_button.focus_neighbor_top = main_menu_button.get_path()
|
||||
main_menu_button.focus_neighbor_bottom = continue_button.get_path()
|
||||
|
||||
|
||||
func _on_continue_button_pressed() -> void:
|
||||
continue_game.emit()
|
||||
|
||||
|
||||
func _on_options_button_pressed() -> void:
|
||||
show_options.emit()
|
||||
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
@@ -0,0 +1 @@
|
||||
uid://npqs2m5g5bd6
|
||||
@@ -0,0 +1,49 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bclo2wl8ibrcg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://npqs2m5g5bd6" path="res://game/menu/ingame/pause_menu.gd" id="1_inj1j"]
|
||||
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_vy7sn"]
|
||||
|
||||
[sub_resource type="Shortcut" id="Shortcut_lgp46"]
|
||||
|
||||
[node name="PauseMenu" type="Control"]
|
||||
process_mode = 2
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_inj1j")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
top_level = true
|
||||
layout_mode = 0
|
||||
offset_left = 100.0
|
||||
offset_top = 100.0
|
||||
offset_right = 196.0
|
||||
offset_bottom = 166.0
|
||||
|
||||
[node name="ContinueButton" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_vy7sn")
|
||||
shortcut = SubResource("Shortcut_lgp46")
|
||||
text = "CONTINUE"
|
||||
|
||||
[node name="OptionsButton" type="Button" parent="VBoxContainer"]
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_vy7sn")
|
||||
text = "OPTIONS"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_vy7sn")
|
||||
text = "MAIN MENU"
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ContinueButton" to="." method="_on_continue_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
@@ -0,0 +1,56 @@
|
||||
extends Control
|
||||
|
||||
|
||||
signal continue_game
|
||||
signal show_main_menu
|
||||
|
||||
|
||||
@onready var pause_menu : Control = $PauseMenu
|
||||
@onready var options : Control = $Options
|
||||
@onready var credits : Control = $Credits
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_show_menu(pause_menu)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("pause") or event.is_action_pressed("ui_cancel"):
|
||||
_on_pause_menu_continue_game.call_deferred()
|
||||
|
||||
|
||||
func _show_menu(menu: Control) -> void:
|
||||
var menus : Array[Control] = [ pause_menu, options, credits ]
|
||||
|
||||
for m in menus:
|
||||
m.hide()
|
||||
|
||||
menu.show()
|
||||
|
||||
|
||||
func _on_pause_menu_continue_game() -> void:
|
||||
continue_game.emit()
|
||||
|
||||
|
||||
func _on_pause_menu_show_main_menu() -> void:
|
||||
show_main_menu.emit()
|
||||
|
||||
|
||||
func _on_pause_menu_show_options() -> void:
|
||||
_show_menu(options)
|
||||
|
||||
|
||||
func _on_options_back() -> void:
|
||||
_show_menu(pause_menu)
|
||||
|
||||
|
||||
func _on_options_show_credits() -> void:
|
||||
_show_menu(credits)
|
||||
|
||||
|
||||
func _on_credits_back() -> void:
|
||||
_show_menu(options)
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
get_tree().paused = visible
|
||||
@@ -0,0 +1 @@
|
||||
uid://c5d2t2o53wkmt
|
||||
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d34nh3lc1gpb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c5d2t2o53wkmt" path="res://game/menu/ingame/pause_screen.gd" id="1_fe1q8"]
|
||||
[ext_resource type="PackedScene" uid="uid://bclo2wl8ibrcg" path="res://game/menu/ingame/pause_menu.tscn" id="2_4r6ly"]
|
||||
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://game/menu/common/options.tscn" id="3_3gwb3"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://game/menu/common/credits.tscn" id="4_jph5s"]
|
||||
|
||||
[node name="PauseScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_fe1q8")
|
||||
|
||||
[node name="PauseMenu" parent="." instance=ExtResource("2_4r6ly")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource("3_3gwb3")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Credits" parent="." instance=ExtResource("4_jph5s")]
|
||||
layout_mode = 0
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="continue_game" from="PauseMenu" to="." method="_on_pause_menu_continue_game"]
|
||||
[connection signal="show_main_menu" from="PauseMenu" to="." method="_on_pause_menu_show_main_menu"]
|
||||
[connection signal="show_options" from="PauseMenu" to="." method="_on_pause_menu_show_options"]
|
||||
[connection signal="back" from="Options" to="." method="_on_options_back"]
|
||||
[connection signal="show_credits" from="Options" to="." method="_on_options_show_credits"]
|
||||
[connection signal="back" from="Credits" to="." method="_on_credits_back"]
|
||||
@@ -0,0 +1,21 @@
|
||||
extends Control
|
||||
|
||||
|
||||
signal show_main_menu
|
||||
|
||||
|
||||
@onready var main_menu_button : Button = $%MainMenuButton
|
||||
@onready var button_focus_timer : Timer = $ButtonFocusTimer
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
main_menu_button.grab_focus()
|
||||
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if visible and button_focus_timer:
|
||||
button_focus_timer.start()
|
||||
@@ -0,0 +1 @@
|
||||
uid://b0p1ewlw18ijg
|
||||
@@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bdcs2ff85qjs4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0p1ewlw18ijg" path="res://game/menu/ingame/victory_screen.gd" id="1_asigk"]
|
||||
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_wb4d8"]
|
||||
|
||||
[node name="VictoryScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_asigk")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"]
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
text = "Victory!"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 100
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_wb4d8")
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="ButtonFocusTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="CenterContainer/VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="timeout" from="ButtonFocusTimer" to="." method="_on_timer_timeout"]
|
||||
@@ -0,0 +1,39 @@
|
||||
class_name WeaponSelectionScreen
|
||||
extends Control
|
||||
|
||||
|
||||
signal weapon_selected(weapon_data: WeaponData)
|
||||
|
||||
|
||||
const WEAPON_SELECTOR = preload("res://game/menu/ingame/weapon_selector.tscn")
|
||||
|
||||
|
||||
@export var world_data : WorldData:
|
||||
set = _set_world_data
|
||||
|
||||
|
||||
@onready var weapon_selectors : Control = $%WeaponSelectors
|
||||
|
||||
|
||||
func _set_world_data(data: WorldData) -> void:
|
||||
world_data = data
|
||||
|
||||
for child in weapon_selectors.get_children():
|
||||
child.queue_free()
|
||||
|
||||
if world_data == null: return
|
||||
|
||||
var selectors : Array[WeaponSelector] = []
|
||||
for weapon_data in world_data.player_start_weapons:
|
||||
var selector : WeaponSelector = WEAPON_SELECTOR.instantiate()
|
||||
weapon_selectors.add_child(selector)
|
||||
selector.weapon_data = weapon_data
|
||||
selectors.append(selector)
|
||||
selector.weapon_selected.connect(_on_weapon_selected)
|
||||
|
||||
if selectors.size() > 0:
|
||||
selectors[0].button.grab_focus()
|
||||
|
||||
|
||||
func _on_weapon_selected(weapon_data: WeaponData) -> void:
|
||||
weapon_selected.emit(weapon_data)
|
||||
@@ -0,0 +1 @@
|
||||
uid://6isk1tmc2ik1
|
||||
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cv122gw47cnun"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://6isk1tmc2ik1" path="res://game/menu/ingame/weapon_selection_screen.gd" id="1_hl2ql"]
|
||||
|
||||
[node name="WeaponSelectionScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_hl2ql")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 640.0
|
||||
offset_bottom = 360.0
|
||||
theme_override_constants/margin_left = 16
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_right = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
text = "Select your first weapon"
|
||||
|
||||
[node name="WeaponSelectors" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
alignment = 1
|
||||
@@ -0,0 +1,27 @@
|
||||
class_name WeaponSelector
|
||||
extends Control
|
||||
|
||||
|
||||
signal weapon_selected(weapon_data: WeaponData)
|
||||
|
||||
|
||||
@export var weapon_data: WeaponData:
|
||||
set = _set_weapon_data
|
||||
|
||||
|
||||
@onready var button : Button = $%Button
|
||||
@onready var name_label : Label = $%NameLabel
|
||||
@onready var description_label : Label = $%DescriptionLabel
|
||||
|
||||
|
||||
func _set_weapon_data(data: WeaponData) -> void:
|
||||
weapon_data = data
|
||||
|
||||
if weapon_data == null: return
|
||||
|
||||
name_label.text = weapon_data.name
|
||||
description_label.text = weapon_data.description
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
weapon_selected.emit(weapon_data)
|
||||
@@ -0,0 +1 @@
|
||||
uid://beiydi6w6gqqc
|
||||
@@ -0,0 +1,46 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://1o3idp54lil2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://beiydi6w6gqqc" path="res://game/menu/ingame/weapon_selector.gd" id="1_4acia"]
|
||||
[ext_resource type="Theme" uid="uid://dtnd3tqllufey" path="res://images/menu_button.tres" id="2_g83h6"]
|
||||
|
||||
[node name="WeaponSelector" type="MarginContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
script = ExtResource("1_4acia")
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_g83h6")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="NameLabel" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_g83h6")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="DescriptionLabel" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(160, 0)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 8
|
||||
horizontal_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||
Reference in New Issue
Block a user