hitbox.tscn 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. [gd_scene load_steps=8 format=2]
  2. [ext_resource path="res://hitbox.gd" type="Script" id=1]
  3. [ext_resource path="res://target4.png" type="Texture" id=2]
  4. [ext_resource path="res://expand.gd" type="Script" id=3]
  5. [ext_resource path="res://sounds/woosh.ogg" type="AudioStream" id=4]
  6. [sub_resource type="RectangleShape2D" id=1]
  7. extents = Vector2( 32, 32 )
  8. [sub_resource type="Shader" id=2]
  9. code = "// NOTE: Shader automatically converted from Godot Engine 3.4.4.stable's CanvasItemMaterial.
  10. shader_type canvas_item;
  11. render_mode blend_mix;
  12. uniform float speed = 5f;
  13. vec2 rotateUV(vec2 uv, float rotation)
  14. {
  15. float mid = 0.5;
  16. return vec2(
  17. cos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,
  18. cos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid
  19. );
  20. }
  21. void vertex() {
  22. UV= rotateUV((UV*0.75)+vec2(0.125),TIME*speed );
  23. }
  24. void fragment() {
  25. vec4 albedo_tex = texture(TEXTURE,UV);
  26. COLOR.rgb = albedo_tex.rgb + vec3(sin(TIME*10.0)/10.0);
  27. COLOR.a = albedo_tex.a;
  28. }
  29. "
  30. [sub_resource type="ShaderMaterial" id=3]
  31. shader = SubResource( 2 )
  32. shader_param/speed = 5.0
  33. [node name="hitbox" type="Area2D"]
  34. script = ExtResource( 1 )
  35. [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
  36. shape = SubResource( 1 )
  37. [node name="Timer" type="Timer" parent="."]
  38. autostart = true
  39. [node name="Target4" type="Sprite" parent="."]
  40. modulate = Color( 2, 2, 0, 1 )
  41. material = SubResource( 3 )
  42. texture = ExtResource( 2 )
  43. [node name="expand" type="Node" parent="."]
  44. script = ExtResource( 3 )
  45. nodepath = NodePath("../Target4")
  46. [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
  47. stream = ExtResource( 4 )
  48. bus = "sfx"
  49. [connection signal="body_entered" from="." to="." method="_on_hitbox_body_entered"]