Fix para los items que no caen
This commit is contained in:
1 parent
e1e29f02f1
commit
aeb5b324f1
28 files changed
+194
-54
No files matched your search
@@ -9,7 +9,7 @@ id = &"amplificador_11"
|
||||
display_name = "Amplificador al 11"
|
||||
description = "El 10 era para cobardes."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#f37e6d")
|
||||
color = Color(0.95294118, 0.49411765, 0.42745098, 1.0)
|
||||
effect_type = "special_charge"
|
||||
value = 100.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"baqueta_sismica"
|
||||
display_name = "Baqueta Sismica"
|
||||
description = "Una prueba de sonido y desaparecio el suelo."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#eac58c")
|
||||
color = Color(0.91764706, 0.77254902, 0.54901961, 1.0)
|
||||
effect_type = "air_damage_boost"
|
||||
value = 0.5
|
||||
duration = 10.0
|
||||
@@ -9,7 +9,7 @@ id = &"beer"
|
||||
display_name = "Espuma del Pogo"
|
||||
description = "Espuma garantizada. El contenido, no tanto."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#ffcd5b")
|
||||
color = Color(1.00000000, 0.80392157, 0.35686275, 1.0)
|
||||
effect_type = "heal"
|
||||
value = 30.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"bocata_roadie"
|
||||
display_name = "Bocata del Roadie"
|
||||
description = "Lleva tres giras en la furgoneta."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#f0ae55")
|
||||
color = Color(0.94117647, 0.68235294, 0.33333333, 1.0)
|
||||
effect_type = "heal"
|
||||
value = 20.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"botas_doble_bombo"
|
||||
display_name = "Botas del Doble Bombo"
|
||||
description = "El bateria marca el ritmo de la carrera."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#b99afa")
|
||||
color = Color(0.72549020, 0.60392157, 0.98039216, 1.0)
|
||||
effect_type = "speed_boost"
|
||||
value = 0.35
|
||||
duration = 8.0
|
||||
@@ -9,7 +9,7 @@ id = &"casete_demo"
|
||||
display_name = "Casete de la Demo Perdida"
|
||||
description = "Grabado en un garaje. Se nota."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#ec9fcd")
|
||||
color = Color(0.92549020, 0.62352941, 0.80392157, 1.0)
|
||||
effect_type = "special_charge"
|
||||
value = 25.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"cinta_americana"
|
||||
display_name = "Cinta Americana Infinita"
|
||||
description = "Arregla todo, menos la afinacion."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#a1c1cc")
|
||||
color = Color(0.63137255, 0.75686275, 0.80000000, 1.0)
|
||||
effect_type = "shield"
|
||||
value = 1.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"coffee"
|
||||
display_name = "Tostado del Averno"
|
||||
description = "240 BPM por las venas."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#9b6243")
|
||||
color = Color(0.60784314, 0.38431373, 0.26274510, 1.0)
|
||||
effect_type = "speed_boost"
|
||||
value = 0.25
|
||||
duration = 12.0
|
||||
@@ -9,7 +9,7 @@ id = &"cuerda_titanio"
|
||||
display_name = "Cuerda de Titanio"
|
||||
description = "No desafina. Tampoco perdona."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#e5e6fc")
|
||||
color = Color(0.89803922, 0.90196078, 0.98823529, 1.0)
|
||||
effect_type = "damage_boost"
|
||||
value = 0.2
|
||||
duration = 20.0
|
||||
@@ -9,6 +9,6 @@ id = &"lab_control"
|
||||
display_name = "Testigo del Laboratorio"
|
||||
description = "Un objeto de control para comprobar los pickups sin combatir."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#a1c1cc")
|
||||
color = Color(0.63137255, 0.75686275, 0.80000000, 1.0)
|
||||
effect_type = "shield"
|
||||
value = 1.0
|
||||
@@ -9,7 +9,7 @@ id = &"lata_feedback"
|
||||
display_name = "Lata de Feedback"
|
||||
description = "Hace mas ruido al abrirse que el guitarrista."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#f55b78")
|
||||
color = Color(0.96078431, 0.35686275, 0.47058824, 1.0)
|
||||
effect_type = "speed_boost"
|
||||
value = 0.15
|
||||
duration = 20.0
|
||||
@@ -9,7 +9,7 @@ id = &"muelles_stage"
|
||||
display_name = "Muelles del Stage Diving"
|
||||
description = "El aterrizaje no esta incluido."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#82d8f3")
|
||||
color = Color(0.50980392, 0.84705882, 0.95294118, 1.0)
|
||||
effect_type = "jump_boost"
|
||||
value = 0.2
|
||||
duration = 12.0
|
||||
@@ -9,7 +9,7 @@ id = &"pedal_distorsion"
|
||||
display_name = "Pedal de Distorsion"
|
||||
description = "El tecnico de sonido ha dimitido."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#76bddc")
|
||||
color = Color(0.46274510, 0.74117647, 0.86274510, 1.0)
|
||||
effect_type = "damage_boost"
|
||||
value = 0.5
|
||||
duration = 7.0
|
||||
@@ -9,7 +9,7 @@ id = &"pizza_post_bolo"
|
||||
display_name = "Pizza Post-Bolo"
|
||||
description = "La encontraron detras del amplificador."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#f9a047")
|
||||
color = Color(0.97647059, 0.62745098, 0.27843137, 1.0)
|
||||
effect_type = "heal"
|
||||
value = 45.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"pua_apocalipsis"
|
||||
display_name = "Pua del Apocalipsis"
|
||||
description = "Tres acordes. Cero supervivientes."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#dc78f8")
|
||||
color = Color(0.86274510, 0.47058824, 0.97254902, 1.0)
|
||||
effect_type = "damage_boost"
|
||||
value = 0.3
|
||||
duration = 12.0
|
||||
@@ -9,7 +9,7 @@ id = &"setlist_fin"
|
||||
display_name = "Setlist del Fin del Mundo"
|
||||
description = "Si no queda escenario, el orden da igual."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#f1e7a3")
|
||||
color = Color(0.94509804, 0.90588235, 0.63921569, 1.0)
|
||||
effect_type = "special_charge"
|
||||
value = 50.0
|
||||
duration = 0.0
|
||||
@@ -9,7 +9,7 @@ id = &"tapones_tecnico"
|
||||
display_name = "Tapones del Tecnico"
|
||||
description = "Por una vez, el tecnico tenia razon."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#c2eb7e")
|
||||
color = Color(0.76078431, 0.92156863, 0.49411765, 1.0)
|
||||
effect_type = "damage_reduction"
|
||||
value = 0.25
|
||||
duration = 12.0
|
||||
@@ -9,7 +9,7 @@ id = &"tupper_bateria"
|
||||
display_name = "Tupper del Bateria"
|
||||
description = "Ni su madre recuerda que le puso."
|
||||
icon = ExtResource("2_icon")
|
||||
color = Color("#83d0c5")
|
||||
color = Color(0.51372549, 0.81568627, 0.77254902, 1.0)
|
||||
effect_type = "heal"
|
||||
value = 70.0
|
||||
duration = 0.0
|
||||
@@ -58,5 +58,6 @@ static func spawn_drops(drops_data: Array[PickupData], parent: Node, position: V
|
||||
continue
|
||||
var pickup := PICKUP_SCENE.instantiate() as Pickup
|
||||
pickup.pickup_data = data
|
||||
pickup.collection_delay_seconds = Pickup.DROP_COLLECTION_DELAY_SECONDS
|
||||
pickup.position = local_position
|
||||
parent.call_deferred("add_child", pickup)
|
||||
+35
-15
@@ -3,11 +3,12 @@ class_name Pickup
|
||||
|
||||
signal picked_up(pickup: Pickup, data: PickupData)
|
||||
|
||||
# Give players a moment to see the item before it can be collected. Otherwise
|
||||
# a close-range kill may immediately pick it up inside the player's collision.
|
||||
const PICKUP_GRACE_SECONDS: float = 0.75
|
||||
# A dropped item needs a moment on screen before it can be collected. Items
|
||||
# already placed in a level have no delay, so you can pick them up immediately.
|
||||
const DROP_COLLECTION_DELAY_SECONDS: float = 0.75
|
||||
|
||||
@export var pickup_data: PickupData
|
||||
@export var collection_delay_seconds: float = 0.0
|
||||
@export var fall_speed: float = 150.0
|
||||
@export var bob_amplitude: float = 4.0
|
||||
@export var bob_speed: float = 3.0
|
||||
@@ -16,6 +17,7 @@ var velocity: Vector2 = Vector2.ZERO
|
||||
var time: float = 0.0
|
||||
var start_y: float = 0.0
|
||||
var grounded: bool = false
|
||||
var _can_collect: bool = false
|
||||
|
||||
@onready var label: Label = $Label
|
||||
@onready var sprite: Sprite2D = $Sprite2D
|
||||
@@ -24,22 +26,38 @@ var grounded: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group("pickup")
|
||||
if pickup_data != null:
|
||||
label.text = pickup_data.display_name
|
||||
sprite.texture = pickup_data.icon
|
||||
placeholder.visible = pickup_data.icon == null
|
||||
placeholder.color = pickup_data.color
|
||||
start_y = position.y
|
||||
body_entered.connect(_on_body_entered)
|
||||
_enable_collection_after_delay()
|
||||
|
||||
if pickup_data == null:
|
||||
# Never silently leave a broken item as the generic white "Item" square.
|
||||
push_error("Pickup without PickupData: %s" % get_path())
|
||||
label.text = "SIN DATOS"
|
||||
placeholder.color = Color.MAGENTA
|
||||
return
|
||||
|
||||
label.text = pickup_data.display_name
|
||||
sprite.texture = pickup_data.icon
|
||||
placeholder.visible = pickup_data.icon == null
|
||||
placeholder.color = pickup_data.color
|
||||
start_y = position.y
|
||||
|
||||
if collection_delay_seconds > 0.0:
|
||||
_enable_collection_after_delay()
|
||||
else:
|
||||
_can_collect = true
|
||||
|
||||
|
||||
func _enable_collection_after_delay() -> void:
|
||||
# The scene starts with monitoring disabled. Enabling it after the initial
|
||||
# grace period also avoids overlap signals during creation in a physics tick.
|
||||
await get_tree().create_timer(PICKUP_GRACE_SECONDS).timeout
|
||||
if is_inside_tree():
|
||||
monitoring = true
|
||||
# Monitoring stays enabled so Godot remembers players already overlapping.
|
||||
# Enabling it only after a timer can miss a fast-moving player completely.
|
||||
await get_tree().create_timer(collection_delay_seconds).timeout
|
||||
if not is_inside_tree():
|
||||
return
|
||||
_can_collect = true
|
||||
for body in get_overlapping_bodies():
|
||||
_on_body_entered(body)
|
||||
if is_queued_for_deletion():
|
||||
break
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
@@ -64,6 +82,8 @@ func is_on_floor() -> bool:
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if not _can_collect or pickup_data == null or is_queued_for_deletion():
|
||||
return
|
||||
if body.is_in_group("player") and body.has_method("collect_pickup"):
|
||||
if body.collect_pickup(pickup_data):
|
||||
picked_up.emit(self, pickup_data)
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ size = Vector2(16, 16)
|
||||
z_index = 2
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
monitoring = false
|
||||
monitoring = true
|
||||
script = ExtResource("1_pickup")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
||||
Reference in new issue
Block a user