Browse Source

:art: Add ball trail

DricomDragon 3 years ago
parent
commit
af86e48056

BIN
godot/image/ball_particle.png


+ 34 - 0
godot/image/ball_particle.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/ball_particle.png-ea9cac2a19e21c5cd5cd785e8d536ab6.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://image/ball_particle.png"
+dest_files=[ "res://.import/ball_particle.png-ea9cac2a19e21c5cd5cd785e8d536ab6.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=true
+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
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 4 - 0
godot/resources/decrease_curve.tres

@@ -0,0 +1,4 @@
+[gd_resource type="Curve" format=2]
+
+[resource]
+_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.290909 ), 0.0, 0.0, 0, 0 ]

+ 28 - 1
godot/scenes/Ball.tscn

@@ -1,7 +1,8 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=9 format=2]
 
 [ext_resource path="res://image/ball.png" type="Texture" id=1]
 [ext_resource path="res://scripts/Ball.gd" type="Script" id=2]
+[ext_resource path="res://image/ball_particle.png" type="Texture" id=3]
 
 [sub_resource type="PhysicsMaterial" id=1]
 friction = 0.0
@@ -10,6 +11,26 @@ bounce = 1.0
 [sub_resource type="CircleShape2D" id=2]
 radius = 5.0
 
+[sub_resource type="Curve" id=4]
+_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.290909 ), 0.0, 0.0, 0, 0 ]
+
+[sub_resource type="CurveTexture" id=5]
+curve = SubResource( 4 )
+
+[sub_resource type="ParticlesMaterial" id=3]
+flag_disable_z = true
+spread = 0.0
+gravity = Vector3( 0, 0, 0 )
+angular_velocity = 45.0
+angular_velocity_random = 1.0
+orbit_velocity = 0.0
+orbit_velocity_random = 0.0
+angle = 180.0
+angle_random = 1.0
+scale = 0.5
+scale_random = 0.5
+scale_curve = SubResource( 5 )
+
 [node name="Ball" type="RigidBody2D" groups=[
 "ball",
 ]]
@@ -29,3 +50,9 @@ shape = SubResource( 2 )
 
 [node name="Sprite" type="Sprite" parent="."]
 texture = ExtResource( 1 )
+
+[node name="Trail" type="Particles2D" parent="."]
+lifetime = 0.1
+local_coords = false
+process_material = SubResource( 3 )
+texture = ExtResource( 3 )