Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ metadata/_custom_type_script = "uid://du8wfijr35r35"

[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea" unique_id=1121983883]
shape = SubResource("CircleShape2D_ghwae")
debug_color = Color(0.600391, 0.54335, 0, 0.42)
debug_color = Color(0.6, 0.545, 0, 0.42)

[node name="Marker" type="Marker2D" parent="InteractArea" unique_id=1961850851]
position = Vector2(0, -48)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://b8mjjvpetr2sx"
path="res://.godot/imported/health_item.png-ffcb4d6c1ce83d09f66b82c207b78406.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://scenes/game_elements/props/health_item/components/health_item.png"
dest_files=["res://.godot/imported/health_item.png-ffcb4d6c1ce83d09f66b82c207b78406.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[gd_resource type="SpriteFrames" format=3 uid="uid://xuw3tderjceg"]

[ext_resource type="Texture2D" uid="uid://b8mjjvpetr2sx" path="res://scenes/game_elements/props/health_item/components/health_item.png" id="1_qtkly"]

[sub_resource type="AtlasTexture" id="AtlasTexture_as7yo"]
atlas = ExtResource("1_qtkly")
region = Rect2(0, 0, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_fremn"]
atlas = ExtResource("1_qtkly")
region = Rect2(64, 0, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_0su3u"]
atlas = ExtResource("1_qtkly")
region = Rect2(128, 0, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_xcv83"]
atlas = ExtResource("1_qtkly")
region = Rect2(0, 64, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_8um1a"]
atlas = ExtResource("1_qtkly")
region = Rect2(64, 64, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_eob1k"]
atlas = ExtResource("1_qtkly")
region = Rect2(128, 64, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_84oik"]
atlas = ExtResource("1_qtkly")
region = Rect2(0, 128, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_7cpmn"]
atlas = ExtResource("1_qtkly")
region = Rect2(64, 128, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_gvmf1"]
atlas = ExtResource("1_qtkly")
region = Rect2(128, 128, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_rq52m"]
atlas = ExtResource("1_qtkly")
region = Rect2(0, 192, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_dy20p"]
atlas = ExtResource("1_qtkly")
region = Rect2(64, 192, 64, 64)

[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_as7yo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fremn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0su3u")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xcv83")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8um1a")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eob1k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_84oik")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7cpmn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gvmf1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rq52m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dy20p")
}],
"loop": 1,
"name": &"default",
"speed": 10.0
}]
50 changes: 47 additions & 3 deletions scenes/globals/mouse_manager/mouse_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ signal mode_changed
const MOUSE_CURSOR_DEFAULT = preload("uid://cee2juvnxco6c")
const MOUSE_CURSOR_CROSS = preload("uid://bx11wyx7unc4q")

## Conteo de referencias para controlar cuándo está permitida la interacción con ratón.
var _holds: int = 0

@onready var hide_timer: Timer = %HideTimer


Expand All @@ -15,25 +18,66 @@ func _ready() -> void:
Input.set_custom_mouse_cursor(MOUSE_CURSOR_CROSS, Input.CURSOR_CROSS, Vector2(32, 32))
Input.set_default_cursor_shape(Input.CURSOR_CROSS)

# El cursor comienza oculto hasta que un sistema solicite un hold y se mueva el ratón.
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN

DialogueManager.dialogue_started.connect(_on_dialogue_started)
DialogueManager.dialogue_ended.connect(_on_dialogue_ended)


## Registra una solicitud para habilitar la interacción con el ratón.
func hold() -> void:
_holds += 1


## Libera una solicitud previa de interacción con el ratón.
func release() -> void:
_holds = maxi(0, _holds - 1)
if _holds == 0:
_hide_mouse()


func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
if _holds > 0:
_show_mouse()
elif _is_keyboard_or_controller_event(event):
_hide_mouse()


func _is_keyboard_or_controller_event(event: InputEvent) -> bool:
if event is InputEventKey and event.is_pressed():
return true
if event is InputEventJoypadButton and event.is_pressed():
return true
if event is InputEventJoypadMotion and absf(event.axis_value) > 0.5:
return true
return false


func _show_mouse() -> void:
if Input.mouse_mode != Input.MOUSE_MODE_VISIBLE:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
mode_changed.emit()
hide_timer.start()
hide_timer.start()


func _hide_mouse() -> void:
hide_timer.stop()
if Input.mouse_mode != Input.MOUSE_MODE_HIDDEN:
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
mode_changed.emit()


func _on_hide_timer_timeout() -> void:
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
mode_changed.emit()
_hide_mouse()


func _on_dialogue_started(_resource: DialogueResource) -> void:
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
hold()


func _on_dialogue_ended(_resource: DialogueResource) -> void:
Input.set_default_cursor_shape(Input.CURSOR_CROSS)
release()
1 change: 0 additions & 1 deletion scenes/globals/mouse_manager/mouse_manager.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ script = ExtResource("1_u8i10")
unique_name_in_owner = true
wait_time = 3.0
one_shot = true
autostart = true

[connection signal="timeout" from="HideTimer" to="." method="_on_hide_timer_timeout"]
4 changes: 4 additions & 0 deletions scenes/globals/pause/pause_overlay.gd
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func toggle_pause() -> void:
get_tree().paused = new_state

Input.set_default_cursor_shape(Input.CURSOR_ARROW if new_state else Input.CURSOR_CROSS)
if new_state:
MouseManager.hold()
else:
MouseManager.release()

if new_state:
if not GameState.quest:
Expand Down
10 changes: 10 additions & 0 deletions scenes/menus/title/components/title_screen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ var opening_quest: Quest
@onready var credits: Control = %Credits


func _enter_tree() -> void:
MouseManager.hold()
Input.set_default_cursor_shape(Input.CURSOR_ARROW)


func _exit_tree() -> void:
MouseManager.release()
Input.set_default_cursor_shape(Input.CURSOR_CROSS)


func _ready() -> void:
opening_quest = load(
ThreadbareProjectSettings.get_setting(ThreadbareProjectSettings.OPENING_QUEST)
Expand Down
Loading