A game created for the Godot Wild Jam #21
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4KB

  1. [gd_scene load_steps=5 format=2]
  2. [ext_resource path="res://Data/Graphics/placeholder.png" type="Texture" id=1]
  3. [ext_resource path="res://Data/Scripts/Glowdot.gd" type="Script" id=2]
  4. [sub_resource type="Shader" id=2]
  5. code = "shader_type canvas_item;
  6. uniform vec4 primary_color:hint_color = vec4(1.0, 0.8, 0.0, 1.0);
  7. uniform float fade_offset:hint_range(0.0, 0.5) = 0.1;
  8. float ramp(float v, float f_min, float f_max){
  9. float res = (v - f_min) / (f_max - f_min);
  10. return max(0.0, min(res, 1.0));
  11. }
  12. void fragment(){
  13. float mask = length(vec2(0.5, 0.5) - (UV.xy));
  14. float fade = 1.0 - ramp(mask, fade_offset, 0.5);
  15. if (mask > 0.5){
  16. mask = 0.0;
  17. } else {mask = 1.0;}
  18. if (mask == 1.0){
  19. COLOR = vec4(primary_color.rgb, fade);
  20. } else {
  21. COLOR = vec4(primary_color.rgb, mask);
  22. }
  23. }"
  24. [sub_resource type="ShaderMaterial" id=1]
  25. resource_local_to_scene = true
  26. shader = SubResource( 2 )
  27. shader_param/primary_color = Color( 0, 0, 0, 1 )
  28. shader_param/fade_offset = 0.14
  29. [node name="Glowdot" type="Sprite"]
  30. material = SubResource( 1 )
  31. texture = ExtResource( 1 )
  32. script = ExtResource( 2 )
  33. pulse_offset = 0.1
  34. [node name="Pulse" type="Tween" parent="."]
  35. [node name="PulseIn" type="Timer" parent="."]
  36. [node name="PulseOut" type="Timer" parent="."]
  37. [connection signal="timeout" from="PulseIn" to="." method="_on_PulseIn_timeout"]
  38. [connection signal="timeout" from="PulseOut" to="." method="_on_PulseOut_timeout"]