Add effect dissolve when player click/touch object

This commit is contained in:
VAILLANT Jeremy
2021-05-11 15:36:14 +02:00
parent b85c69bd3f
commit b1eaade304
11 changed files with 139 additions and 10 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/dagger_BC.tga-8c56f407df61bdb7c529101388df0d01.s3tc.stex"
path.etc2="res://.import/dagger_BC.tga-8c56f407df61bdb7c529101388df0d01.etc2.stex"
path.etc="res://.import/dagger_BC.tga-8c56f407df61bdb7c529101388df0d01.etc.stex"
metadata={
"imported_formats": [ "s3tc", "etc2", "etc" ],
"vram_texture": true
}
[deps]
source_file="res://assets/props/dagger/textures/dagger_BC.tga"
dest_files=[ "res://.import/dagger_BC.tga-8c56f407df61bdb7c529101388df0d01.s3tc.stex", "res://.import/dagger_BC.tga-8c56f407df61bdb7c529101388df0d01.etc2.stex", "res://.import/dagger_BC.tga-8c56f407df61bdb7c529101388df0d01.etc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
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=false
svg/scale=1.0
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/props/dagger/textures/dagger_NM.tga"
dest_files=[ "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.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
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/dagger_ORM.tga-e70732208e6213759f9b467913b86699.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/props/dagger/textures/dagger_ORM.tga"
dest_files=[ "res://.import/dagger_ORM.tga-e70732208e6213759f9b467913b86699.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
+27 -5
View File
@@ -1,12 +1,34 @@
extends Spatial extends Spatial
signal clicked(dagger) signal clicked(dagger)
var current_scene = null
var dissolve = null
var wait_frames = 1
var time_max = 2000 # msec
var tick_reference = null
var value = 0.1
func _ready(): func _ready():
print("[Dagger#_ready]")
connect("clicked", self, "handle_piece_click") connect("clicked", self, "handle_piece_click")
func _on_Area_input_event(camera, event, click_position, click_normal, shape_idx): func _on_Area_input_event(_camera, event, _click_position, _click_normal, _shape_idx):
print("[Dagger#_ready] You have clicked in dagger ...")
if event is InputEventMouseButton or event is InputEventScreenTouch: if event is InputEventMouseButton or event is InputEventScreenTouch:
print("[Dagger#_ready] Click !! Click !!") dissolve = true
$dagger.free()
func _process(_delta):
if dissolve == true:
if tick_reference == null:
tick_reference = OS.get_ticks_msec()
print("[Dagger#_process] Reference tick to " + String(tick_reference))
var tick = OS.get_ticks_msec()
print("[Dagger#_process] Dissolve ... " + String(tick) + " < " + String(tick_reference + time_max))
if tick < tick_reference + time_max:
print("[Dagger#_process] Apply value to "+ String(value))
value += 0.01
$dagger.mesh.surface_get_material(0).set("shader_param/dissolve_amount", value)
else:
print("[Dagger#_process] animation ending !!")
dissolve = null
+7 -5
View File
@@ -1,12 +1,13 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/props/dagger/dagger.mesh" type="ArrayMesh" id=1] [ext_resource path="res://assets/props/dagger/dagger.mesh" type="ArrayMesh" id=1]
[ext_resource path="res://assets/props/misc/plane.mesh" type="ArrayMesh" id=2] [ext_resource path="res://assets/props/misc/plane.mesh" type="ArrayMesh" id=2]
[ext_resource path="res://developers/jeremy/Dagger.gd" type="Script" id=3] [ext_resource path="res://developers/jeremy/Dagger.gd" type="Script" id=3]
[ext_resource path="res://assets/props/dagger/materials/MA_dagger.material" type="Material" id=4]
[sub_resource type="CapsuleShape" id=1] [sub_resource type="CapsuleShape" id=1]
radius = 0.136165 radius = 0.0928268
height = 0.0793334 height = 0.330033
[node name="Spatial" type="Spatial"] [node name="Spatial" type="Spatial"]
script = ExtResource( 3 ) script = ExtResource( 3 )
@@ -20,13 +21,14 @@ mesh = ExtResource( 2 )
material/0 = null material/0 = null
[node name="dagger" type="MeshInstance" parent="."] [node name="dagger" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.542265, 0.160108, -0.620212 ) transform = Transform( 0.40207, 0.904171, -0.144269, 0.267663, 0.034613, 0.962891, 0.875612, -0.425765, -0.228096, -0.471081, 0.0121503, -0.16144 )
mesh = ExtResource( 1 ) mesh = ExtResource( 1 )
material/0 = null material/0 = ExtResource( 4 )
[node name="Area" type="Area" parent="dagger"] [node name="Area" type="Area" parent="dagger"]
[node name="CollisionShape" type="CollisionShape" parent="dagger/Area"] [node name="CollisionShape" type="CollisionShape" parent="dagger/Area"]
transform = Transform( 0.984898, 0.0129629, -0.172648, 0.172618, 0.0034483, 0.984983, 0.0133636, -0.99991, 0.00115858, 0, 0.0899074, 0 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[connection signal="input_event" from="dagger/Area" to="." method="_on_Area_input_event"] [connection signal="input_event" from="dagger/Area" to="." method="_on_Area_input_event"]