diff --git a/graphics/particles/dust.png b/graphics/particles/dust.png new file mode 100644 index 0000000..2b421f1 Binary files /dev/null and b/graphics/particles/dust.png differ diff --git a/graphics/particles/dust.png.import b/graphics/particles/dust.png.import new file mode 100644 index 0000000..8c8baf4 --- /dev/null +++ b/graphics/particles/dust.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/dust.png-593a09bcc5bad3a9c1d7cc6869faa351.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/particles/dust.png" +dest_files=[ "res://.import/dust.png-593a09bcc5bad3a9c1d7cc6869faa351.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/objects/player/arrow_projectile.gd b/objects/player/arrow_projectile.gd index ce9837a..de7a5bf 100644 --- a/objects/player/arrow_projectile.gd +++ b/objects/player/arrow_projectile.gd @@ -15,6 +15,15 @@ func _physics_process(delta): if Game.get_sector(global_position + cull_edge) != initial_sector: queue_free() +func _exit_tree(): + # make sure particles node sticks around until particles decay + var particles = $DustParticles + remove_child(particles) + particles.global_position = global_position + particles.emitting = false + get_parent().add_child(particles) + particles.get_node("DeathTimer").start() + #Wall Collision func _on_Area2D_body_entered(body): if body is TileMap or body is StaticBody2D: diff --git a/objects/player/arrow_projectile.tscn b/objects/player/arrow_projectile.tscn index 99d5e29..7617a13 100644 --- a/objects/player/arrow_projectile.tscn +++ b/objects/player/arrow_projectile.tscn @@ -1,14 +1,37 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=1] [ext_resource path="res://graphics/player/arrow.png" type="Texture" id=2] [ext_resource path="res://objects/player/arrow_projectile.gd" type="Script" id=3] +[ext_resource path="res://graphics/particles/dust.png" type="Texture" id=4] [sub_resource type="ShaderMaterial" id=1] shader = ExtResource( 1 ) shader_param/border_color = Color( 0, 0, 0, 1 ) shader_param/border_corners = true +[sub_resource type="Curve" id=3] +_data = [ Vector2( 0, 1 ), 0.0, -0.139481, 0, 0, Vector2( 1, 0 ), -2.82064, 0.0, 0, 0 ] + +[sub_resource type="CurveTexture" id=4] +width = 32 +curve = SubResource( 3 ) + +[sub_resource type="ParticlesMaterial" id=5] +flag_disable_z = true +spread = 180.0 +gravity = Vector3( 0, 0, 0 ) +initial_velocity = 8.0 +initial_velocity_random = 0.18 +orbit_velocity = 0.0 +orbit_velocity_random = 0.0 +damping = 1.0 +angle = 720.0 +angle_random = 1.0 +scale = 0.25 +scale_random = 0.25 +scale_curve = SubResource( 4 ) + [sub_resource type="RectangleShape2D" id=2] extents = Vector2( 5.5, 3.5 ) @@ -20,10 +43,24 @@ material = SubResource( 1 ) z_index = -1 texture = ExtResource( 2 ) +[node name="DustParticles" type="Particles2D" parent="."] +show_behind_parent = true +position = Vector2( -4, 0 ) +z_index = -1 +amount = 24 +local_coords = false +process_material = SubResource( 5 ) +texture = ExtResource( 4 ) + +[node name="DeathTimer" type="Timer" parent="DustParticles"] +one_shot = true + [node name="Area2D" type="Area2D" parent="." groups=["arrow"]] +visible = false [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] position = Vector2( -0.5, -0.5 ) shape = SubResource( 2 ) +[connection signal="timeout" from="DustParticles/DeathTimer" to="DustParticles" method="queue_free"] [connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]