Emit particles when reaching goal
This commit is contained in:
		
							parent
							
								
									a12a8e6193
								
							
						
					
					
						commit
						4b47c30854
					
				
					 2 changed files with 80 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -5,8 +5,10 @@ func _ready():
 | 
			
		|||
 | 
			
		||||
func collided(body):
 | 
			
		||||
	if body.has_method("reach_goal"):
 | 
			
		||||
		get_node("ShineRays").hide()
 | 
			
		||||
		get_node("Particles").emitting = true
 | 
			
		||||
		body.reach_goal()
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
# Should be done in vertex shader
 | 
			
		||||
#func _process(delta):
 | 
			
		||||
#	var camera_pos = get_viewport().get_camera().global_transform.origin
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
[gd_scene load_steps=8 format=2]
 | 
			
		||||
[gd_scene load_steps=10 format=2]
 | 
			
		||||
 | 
			
		||||
[ext_resource path="res://models/flag.glb" type="PackedScene" id=1]
 | 
			
		||||
[ext_resource path="res://scenes/Goal.gd" type="Script" id=2]
 | 
			
		||||
| 
						 | 
				
			
			@ -69,6 +69,51 @@ gradient = SubResource( 4 )
 | 
			
		|||
width = 2
 | 
			
		||||
_sections_unfolded = [ "Resource" ]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="ParticlesMaterial" id=9]
 | 
			
		||||
 | 
			
		||||
render_priority = 0
 | 
			
		||||
trail_divisor = 1
 | 
			
		||||
emission_shape = 0
 | 
			
		||||
flag_align_y = false
 | 
			
		||||
flag_rotate_y = false
 | 
			
		||||
flag_disable_z = false
 | 
			
		||||
spread = 45.0
 | 
			
		||||
flatness = 0.0
 | 
			
		||||
gravity = Vector3( 0, -9.8, 0 )
 | 
			
		||||
initial_velocity = 5.0
 | 
			
		||||
initial_velocity_random = 0.0
 | 
			
		||||
angular_velocity = 3.39
 | 
			
		||||
angular_velocity_random = 0.0
 | 
			
		||||
linear_accel = 0.0
 | 
			
		||||
linear_accel_random = 0.0
 | 
			
		||||
radial_accel = 0.0
 | 
			
		||||
radial_accel_random = 0.0
 | 
			
		||||
tangential_accel = 0.0
 | 
			
		||||
tangential_accel_random = 0.0
 | 
			
		||||
damping = 0.0
 | 
			
		||||
damping_random = 0.0
 | 
			
		||||
angle = 0.0
 | 
			
		||||
angle_random = 0.0
 | 
			
		||||
scale = 1.0
 | 
			
		||||
scale_random = 0.0
 | 
			
		||||
color = Color( 1, 1, 1, 1 )
 | 
			
		||||
hue_variation = 0.0
 | 
			
		||||
hue_variation_random = 0.0
 | 
			
		||||
anim_speed = 0.0
 | 
			
		||||
anim_speed_random = 0.0
 | 
			
		||||
anim_offset = 0.0
 | 
			
		||||
anim_offset_random = 0.0
 | 
			
		||||
anim_loop = false
 | 
			
		||||
_sections_unfolded = [ "Angle", "Gravity", "Initial Velocity", "Resource", "Scale" ]
 | 
			
		||||
 | 
			
		||||
[sub_resource type="CubeMesh" id=8]
 | 
			
		||||
 | 
			
		||||
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
 | 
			
		||||
size = Vector3( 0.5, 0.5, 0.5 )
 | 
			
		||||
subdivide_width = 0
 | 
			
		||||
subdivide_height = 0
 | 
			
		||||
subdivide_depth = 0
 | 
			
		||||
 | 
			
		||||
[node name="Scene Root" index="0" instance=ExtResource( 1 )]
 | 
			
		||||
 | 
			
		||||
script = ExtResource( 2 )
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +170,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2251, 0 )
 | 
			
		|||
shape = SubResource( 1 )
 | 
			
		||||
disabled = false
 | 
			
		||||
 | 
			
		||||
[node name="Sprite3D" type="Sprite3D" parent="." index="4"]
 | 
			
		||||
[node name="ShineRays" type="Sprite3D" parent="." index="4"]
 | 
			
		||||
 | 
			
		||||
transform = Transform( 250, 0, 0, 0, 500, 0, 0, 0, 1, 0, 0, 0 )
 | 
			
		||||
layers = 1
 | 
			
		||||
| 
						 | 
				
			
			@ -160,4 +205,34 @@ __meta__ = {
 | 
			
		|||
"_edit_lock_": true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[node name="Particles" type="Particles" parent="." index="5"]
 | 
			
		||||
 | 
			
		||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.26872, 0 )
 | 
			
		||||
layers = 1
 | 
			
		||||
material_override = null
 | 
			
		||||
cast_shadow = 1
 | 
			
		||||
extra_cull_margin = 0.0
 | 
			
		||||
use_in_baked_light = false
 | 
			
		||||
lod_min_distance = 0.0
 | 
			
		||||
lod_min_hysteresis = 0.0
 | 
			
		||||
lod_max_distance = 0.0
 | 
			
		||||
lod_max_hysteresis = 0.0
 | 
			
		||||
emitting = false
 | 
			
		||||
amount = 8
 | 
			
		||||
lifetime = 1.0
 | 
			
		||||
one_shot = false
 | 
			
		||||
preprocess = 0.0
 | 
			
		||||
speed_scale = 1.0
 | 
			
		||||
explosiveness = 0.5
 | 
			
		||||
randomness = 0.0
 | 
			
		||||
fixed_fps = 0
 | 
			
		||||
fract_delta = true
 | 
			
		||||
visibility_aabb = AABB( -4, -4, -4.30868, 8, 8, 8.61736 )
 | 
			
		||||
local_coords = true
 | 
			
		||||
draw_order = 0
 | 
			
		||||
process_material = SubResource( 9 )
 | 
			
		||||
draw_passes = 1
 | 
			
		||||
draw_pass_1 = SubResource( 8 )
 | 
			
		||||
_sections_unfolded = [ "Draw Passes", "Drawing", "Pause", "Process Material", "Time" ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue