GoDot – Shader – 2D – Donut Shockwave

This shader features a simple “donut shockwave”, based on the following Youtube tutorial. While the tutorial shows and explains a centric based shockwave, this shader implementation has been extended to enable arbitrary shockwave positions.

Parameters

  • force: The distortion amount within the donut circle
  • center: The center of the shockwave
  • size: The size of the outer circle
  • thickness: Size – Thickness = size of the inner circle

Control Script

As usual, the shader can be controlled by various techniques, such as: AnimationPlayer, Static-Value, Control-Script. For simplicity and reusability, I did create a control script which can be attached to any Node2D node. Add the .gd script to a Node2D and call explode(), which will take care of everything else.

You might have noticed, that the global script functions.gd has been referenced. You may either replace the functions.gd’s functionality, or include it into your project as well. (Project -> Project Settings -> AutoLoad)

5 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments