[gd_scene load_steps=9 format=2]

[ext_resource path="res://berry.png" type="Texture" id=1]
[ext_resource path="res://hitbox.tscn" type="PackedScene" id=2]
[ext_resource path="res://Health.tscn" type="PackedScene" id=3]
[ext_resource path="res://fadeout.gd" type="Script" id=4]
[ext_resource path="res://fadein.gd" type="Script" id=5]

[sub_resource type="GDScript" id=1]
script/source = "extends Node2D

var exppt = 1

func _ready():
	$hitbox/CollisionShape2D.call_deferred('set_disabled', true)
	yield(get_tree().create_timer(1.0), 'timeout')
	$hitbox/CollisionShape2D.call_deferred('set_disabled', false)
"

[sub_resource type="Shader" id=2]
code = "// NOTE: Shader automatically converted from Godot Engine 3.4.4.stable's CanvasItemMaterial.

shader_type canvas_item;
render_mode blend_mix;

//void vertex(){
//	VERTEX *= abs(sin(TIME)) + 0.5f;
//}

void fragment(){
	vec4 col = texture(TEXTURE,UV);
	col.rgb *= abs(sin(TIME*5.0)) + 1.0;
	COLOR = col;
}"

[sub_resource type="ShaderMaterial" id=3]
shader = SubResource( 2 )

[node name="Health" type="Node2D"]
script = SubResource( 1 )

[node name="Sprite" type="Sprite" parent="."]
material = SubResource( 3 )
texture = ExtResource( 1 )

[node name="hitbox" parent="." instance=ExtResource( 2 )]
visible = false
modulate = Color( 1, 1, 1, 0 )
dmg = -5
affect = "player"
singletime = true

[node name="Health" parent="." instance=ExtResource( 3 )]
visible = false

[node name="fadeout" type="Node" parent="."]
script = ExtResource( 4 )
nodepath = NodePath("../Sprite")
speed = 3.0

[node name="fadein" type="Node" parent="."]
script = ExtResource( 5 )
nodepath = NodePath("../Sprite")

[node name="Timer" type="Timer" parent="."]

[connection signal="reloaded" from="hitbox" to="fadeout" method="set_physics_process" binds= [ true ]]
[connection signal="timeout" from="Timer" to="." method="queue_free"]
