ajout des particules de roche et changement de l'écran de chargement
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
extends Fork
|
||||
class_name Shovel
|
||||
|
||||
const DIG_PARTICLES := preload("res://entities/player/inventory/scripts/items/utils/dig_particles.tscn")
|
||||
const SHOVEL_ZONE_RADIUS = 50
|
||||
|
||||
func get_item_name() -> String:
|
||||
@@ -33,7 +34,7 @@ func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
||||
return false
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
AudioManager.play_sfx("Dig")
|
||||
AudioManager.play_sfx("Rocks")
|
||||
for area in zone.get_affected_areas():
|
||||
if area and area is Plant:
|
||||
harvest(area, player)
|
||||
@@ -45,5 +46,10 @@ func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
var rock_layer : RockLayer = bodies[rock_layer_id]
|
||||
|
||||
rock_layer.dig_rocks(zone.get_tiles())
|
||||
|
||||
|
||||
var particles := (DIG_PARTICLES.instantiate() as Node2D)
|
||||
player.region.add_child(particles)
|
||||
particles.global_position = zone.get_global_position()
|
||||
|
||||
return true
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
[gd_scene format=3 uid="uid://d4bokthua8vum"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://rjpuk6wfusk0" path="res://entities/player/inventory/scripts/items/utils/scripts/dig_particles.gd" id="1_80bhs"]
|
||||
[ext_resource type="PackedScene" uid="uid://drf23tyb65cpc" path="res://common/vfx/particles/explosion_particles.tscn" id="1_c4ts5"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_7foqj"]
|
||||
offsets = PackedFloat32Array(0, 0.73362446, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0.84705883, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_w1iqb"]
|
||||
_limits = [-1.0, 1.0, 0.0, 1.0]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[node name="DigParticles" type="Node2D" unique_id=358042179]
|
||||
script = ExtResource("1_80bhs")
|
||||
|
||||
[node name="ExplosionParticles" parent="." unique_id=1558673457 instance=ExtResource("1_c4ts5")]
|
||||
unique_name_in_owner = true
|
||||
amount = 10
|
||||
lifetime = 1.0
|
||||
speed_scale = 3.0
|
||||
spread = 50.0
|
||||
gravity = Vector2(0, 400)
|
||||
initial_velocity_min = 150.0
|
||||
initial_velocity_max = 200.0
|
||||
scale_amount_min = 0.2
|
||||
scale_amount_max = 0.3
|
||||
color = Color(0.5372549, 0.54901963, 0.5137255, 1)
|
||||
color_ramp = SubResource("Gradient_7foqj")
|
||||
hue_variation_min = -0.05
|
||||
hue_variation_max = 0.05
|
||||
hue_variation_curve = SubResource("Curve_w1iqb")
|
||||
@@ -0,0 +1,9 @@
|
||||
extends Node2D
|
||||
|
||||
func _ready():
|
||||
print("Emitting !")
|
||||
%ExplosionParticles.emitting = true
|
||||
%ExplosionParticles.finished.connect(
|
||||
queue_free
|
||||
)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://rjpuk6wfusk0
|
||||
Reference in New Issue
Block a user