Healthpickup.tscn 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. [gd_scene load_steps=9 format=2]
  2. [ext_resource path="res://berry.png" type="Texture" id=1]
  3. [ext_resource path="res://hitbox.tscn" type="PackedScene" id=2]
  4. [ext_resource path="res://Health.tscn" type="PackedScene" id=3]
  5. [ext_resource path="res://fadeout.gd" type="Script" id=4]
  6. [ext_resource path="res://fadein.gd" type="Script" id=5]
  7. [sub_resource type="GDScript" id=1]
  8. script/source = "extends Node2D
  9. var exppt = 1
  10. func _ready():
  11. $hitbox/CollisionShape2D.call_deferred('set_disabled', true)
  12. yield(get_tree().create_timer(1.0), 'timeout')
  13. $hitbox/CollisionShape2D.call_deferred('set_disabled', false)
  14. "
  15. [sub_resource type="Shader" id=2]
  16. code = "// NOTE: Shader automatically converted from Godot Engine 3.4.4.stable's CanvasItemMaterial.
  17. shader_type canvas_item;
  18. render_mode blend_mix;
  19. //void vertex(){
  20. // VERTEX *= abs(sin(TIME)) + 0.5f;
  21. //}
  22. void fragment(){
  23. vec4 col = texture(TEXTURE,UV);
  24. col.rgb *= abs(sin(TIME*5.0)) + 1.0;
  25. COLOR = col;
  26. }"
  27. [sub_resource type="ShaderMaterial" id=3]
  28. shader = SubResource( 2 )
  29. [node name="Health" type="Node2D"]
  30. script = SubResource( 1 )
  31. [node name="Sprite" type="Sprite" parent="."]
  32. material = SubResource( 3 )
  33. texture = ExtResource( 1 )
  34. [node name="hitbox" parent="." instance=ExtResource( 2 )]
  35. visible = false
  36. modulate = Color( 1, 1, 1, 0 )
  37. dmg = -10
  38. affect = "player"
  39. [node name="Health" parent="." instance=ExtResource( 3 )]
  40. visible = false
  41. [node name="fadeout" type="Node" parent="."]
  42. script = ExtResource( 4 )
  43. nodepath = NodePath("../Sprite")
  44. speed = 3.0
  45. [node name="fadein" type="Node" parent="."]
  46. script = ExtResource( 5 )
  47. nodepath = NodePath("../Sprite")
  48. [node name="Timer" type="Timer" parent="."]
  49. [connection signal="reloaded" from="hitbox" to="fadeout" method="set_physics_process" binds= [ true ]]
  50. [connection signal="timeout" from="Timer" to="." method="queue_free"]