From 8548859dde6e9d838b49fd7b7bdcccee175a9743 Mon Sep 17 00:00:00 2001 From: Ichicoro Date: Sat, 7 Jan 2023 14:50:22 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=91=A9=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=F0=9F=94=A7=20Add=20missing=20input=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- island/Island.tscn | 2 +- menu/Menu.tscn | 22 ++++++++++------ player/Player.tscn | 64 ++++++++++------------------------------------ player/player.gd | 8 +++--- project.godot | 20 +++++++++++++++ 5 files changed, 51 insertions(+), 65 deletions(-) diff --git a/island/Island.tscn b/island/Island.tscn index 385b3bb..41b6e1a 100644 --- a/island/Island.tscn +++ b/island/Island.tscn @@ -10,7 +10,7 @@ script/source = "extends Node3D # Called when the node enters the scene tree for the first time. func _ready() -> void: - $Island.get_active_material(0).set(\"texture_filter\", BaseMaterial3D.TextureFilter.TEXTURE_FILTER_NEAREST) + $Island.get_active_material(0).texture_filter = BaseMaterial3D.TextureFilter.TEXTURE_FILTER_NEAREST # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/menu/Menu.tscn b/menu/Menu.tscn index 22f8581..392a169 100644 --- a/menu/Menu.tscn +++ b/menu/Menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=4 format=3 uid="uid://bufi0wh54u5x5"] +[gd_scene load_steps=5 format=3 uid="uid://bufi0wh54u5x5"] [ext_resource type="Theme" uid="uid://c5a1nyqumj46j" path="res://menu/menu_theme.tres" id="1_mkxnc"] [ext_resource type="Script" path="res://menu/Menu.gd" id="2_6amk3"] @@ -36,7 +36,6 @@ theme = ExtResource("1_mkxnc") script = ExtResource("2_6amk3") [node name="Panel" type="TextureRect" parent="."] -layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -46,7 +45,6 @@ texture = ExtResource("2_q14jx") stretch_mode = 1 [node name="Content" type="VBoxContainer" parent="."] -layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -55,23 +53,29 @@ grow_vertical = 2 alignment = 1 [node name="Authors" type="Label" parent="Content"] -layout_mode = 2 +offset_right = 284.0 +offset_bottom = 18.0 text = "A game by Ichicoro and Steffo" horizontal_alignment = 1 [node name="Title" type="Label" parent="Content"] -layout_mode = 2 +offset_top = 25.0 +offset_right = 284.0 +offset_bottom = 75.0 size_flags_vertical = 6 theme_override_font_sizes/font_size = 48 text = "Harvest" horizontal_alignment = 1 [node name="Control" type="Control" parent="Content"] -layout_mode = 2 +layout_mode = 3 +anchors_preset = 0 +offset_top = 110.0 +offset_right = 284.0 +offset_bottom = 110.0 size_flags_vertical = 6 [node name="Play" type="Button" parent="Content/Control"] -layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -90,7 +94,9 @@ text = "Play" script = SubResource("GDScript_25oo4") [node name="Authors2" type="Label" parent="Content"] -layout_mode = 2 +offset_top = 142.0 +offset_right = 284.0 +offset_bottom = 160.0 size_flags_vertical = 1 text = "Ludum Dare 52 - Harvest" horizontal_alignment = 1 diff --git a/player/Player.tscn b/player/Player.tscn index 113778c..b952bd2 100644 --- a/player/Player.tscn +++ b/player/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=3 uid="uid://dnrl0uycbw3lp"] +[gd_scene load_steps=16 format=3 uid="uid://dnrl0uycbw3lp"] [ext_resource type="Script" path="res://player/player.gd" id="1_rujcr"] [ext_resource type="Script" path="res://player/Head.gd" id="2_ohlgu"] @@ -68,9 +68,6 @@ func spawn_points_label(text: String, offset: Vector2): " -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_avmet"] -bg_color = Color(0, 0, 0, 0.647059) - [sub_resource type="GDScript" id="GDScript_7qy62"] script/source = "extends Camera3D @@ -96,12 +93,12 @@ func _process(delta: float) -> void: shader = ExtResource("4_dut1p") shader_parameter/center_enabled = false shader_parameter/legs_enabled = true -shader_parameter/inverted = false -shader_parameter/color_id = null -shader_parameter/color_0 = null -shader_parameter/color_1 = null -shader_parameter/color_2 = null -shader_parameter/center_radius = 0.002 +shader_parameter/inverted = true +shader_parameter/color_id = 0 +shader_parameter/color_0 = Quaternion(0, 1, 0, 1) +shader_parameter/color_1 = Quaternion(1, 0, 0, 1) +shader_parameter/color_2 = Quaternion(0, 0, 1, 1) +shader_parameter/center_radius = 0.005 shader_parameter/width = 0.001 shader_parameter/len = 0.008 shader_parameter/spacing = 0.006 @@ -152,13 +149,12 @@ grow_vertical = 2 stretch = true [node name="GameViewport" type="SubViewport" parent="Head/Viewport/CameraViewportContainer"] -transparent_bg = true handle_input_locally = false -size = Vector2i(284, 160) render_target_update_mode = 4 [node name="Camera" type="Camera3D" parent="Head/Viewport/CameraViewportContainer/GameViewport"] transform = Transform3D(1, 0, 1.74846e-07, 0, 1, 0, -1.74846e-07, 0, 1, 0, 0.54, 0) +cull_mask = 1048573 current = true fov = 80.0 near = 0.001 @@ -186,6 +182,7 @@ grow_vertical = 2 theme = SubResource("Theme_smyke") [node name="FPS_Label" type="Label" parent="HUD"] +visible = false layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 @@ -210,6 +207,7 @@ grow_vertical = 2 script = SubResource("GDScript_5d122") [node name="Speed_Label" type="Label" parent="HUD"] +visible = false layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 @@ -225,31 +223,6 @@ grow_vertical = 2 horizontal_alignment = 1 vertical_alignment = 1 -[node name="Panel" type="Panel" parent="HUD"] -visible = false -layout_mode = 1 -anchors_preset = 3 -anchor_left = 1.0 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -276.0 -offset_top = -122.0 -offset_right = -40.0 -offset_bottom = -40.0 -grow_horizontal = 0 -grow_vertical = 0 -theme_override_styles/panel = SubResource("StyleBoxFlat_avmet") - -[node name="ColorRect" type="ColorRect" parent="HUD/Panel"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0, 0, 0, 0.745098) - [node name="BackBufferCopy2" type="BackBufferCopy" parent="HUD"] position = Vector2(727, 447) scale = Vector2(7.61, 4.89) @@ -285,24 +258,13 @@ layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_top = -5.0 -offset_bottom = -5.0 grow_horizontal = 2 grow_vertical = 2 [node name="BackBufferCopy" type="BackBufferCopy" parent="HUD"] -y_sort_enabled = true -position = Vector2(721, 449) -scale = Vector2(7.21, 4.54) - -[node name="GameFilter" type="ColorRect" parent="HUD"] visible = false -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -metadata/_edit_layout_mode = 1 +y_sort_enabled = true +position = Vector2(140, 79) +scale = Vector2(1.65, 1) [node name="RigidDynamicBody3D" type="RigidBody3D" parent="."] diff --git a/player/player.gd b/player/player.gd index af4890b..5e87b82 100644 --- a/player/player.gd +++ b/player/player.gd @@ -8,6 +8,8 @@ const MOUSE_SENSITIVITY = 2.25 const MAX_AIR_WISH_SPEED = 20 const AIR_ACCELERATE = 100 # Hu/39.97 +@export var viewport_resolution: Vector2 = Vector2(852, 420) + @onready var head: Node3D = $Head @onready var camera: Camera3D = head.get_node("Viewport/CameraViewportContainer/GameViewport/Camera") @onready var vport: SubViewport = head.get_node("Viewport/CameraViewportContainer/GameViewport") @@ -41,11 +43,7 @@ func _get_2d_velocity() -> Vector2: func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) OnHand.player = self -# vport.size = DisplayServer.window_get_size() - vport.size = Vector2(426, 240) -# for item in OnHand.get_children(): -# if item is BaseWeapon: -# item.player = self + vport.size = viewport_resolution func _process(delta): pass diff --git a/project.godot b/project.godot index d58d0cc..dea0f1b 100644 --- a/project.godot +++ b/project.godot @@ -76,6 +76,26 @@ jump={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"unicode":0,"echo":false,"script":null) ] } +slot1={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"unicode":0,"echo":false,"script":null) +] +} +slot2={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"unicode":0,"echo":false,"script":null) +] +} +slot3={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"unicode":0,"echo":false,"script":null) +] +} +toggle_torch={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"unicode":0,"echo":false,"script":null) +] +} [rendering] From 2ecaae3ab5cfa430701b57f66bca6d4a3746c833 Mon Sep 17 00:00:00 2001 From: Ichicoro Date: Sat, 7 Jan 2023 14:54:15 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20Fix=20crosshair=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- player/Player.tscn | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/player/Player.tscn b/player/Player.tscn index b952bd2..9d82622 100644 --- a/player/Player.tscn +++ b/player/Player.tscn @@ -93,9 +93,9 @@ func _process(delta: float) -> void: shader = ExtResource("4_dut1p") shader_parameter/center_enabled = false shader_parameter/legs_enabled = true -shader_parameter/inverted = true +shader_parameter/inverted = false shader_parameter/color_id = 0 -shader_parameter/color_0 = Quaternion(0, 1, 0, 1) +shader_parameter/color_0 = Vector4(1, 1, 1, 1) shader_parameter/color_1 = Quaternion(1, 0, 0, 1) shader_parameter/color_2 = Quaternion(0, 0, 1, 1) shader_parameter/center_radius = 0.005 @@ -140,7 +140,6 @@ grow_horizontal = 2 grow_vertical = 2 [node name="CameraViewportContainer" type="SubViewportContainer" parent="Head/Viewport"] -layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -183,7 +182,6 @@ theme = SubResource("Theme_smyke") [node name="FPS_Label" type="Label" parent="HUD"] visible = false -layout_mode = 1 anchors_preset = 1 anchor_left = 1.0 anchor_right = 1.0 @@ -196,7 +194,7 @@ horizontal_alignment = 2 script = SubResource("GDScript_iiadi") [node name="PointsSpawner" type="Control" parent="HUD"] -layout_mode = 1 +layout_mode = 3 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -208,7 +206,6 @@ script = SubResource("GDScript_5d122") [node name="Speed_Label" type="Label" parent="HUD"] visible = false -layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -231,7 +228,6 @@ copy_mode = 2 [node name="SubViewportContainer" type="SubViewportContainer" parent="HUD"] visible = false show_behind_parent = true -layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -254,7 +250,6 @@ MainCamera = NodePath("../../../../Head/Viewport/CameraViewportContainer/GameVie [node name="Crosshair" type="ColorRect" parent="HUD"] material = SubResource("ShaderMaterial_2p6rt") -layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0