Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new screen shake feature, allowing you to set the amplitude/frequency for both horizontal and vertical screen shakes, independently.
Note: This feature requires adding the Screen Shake Layer to your styles, and it has NOT been added to the default styles at this time.
Amplitude/frequency can both be faded over time, and they have a separate duration that does not include the fade time. This allows for a smooth transition into and out of shaking the screen, while still allowing the full strength of the shake to last for a particular duration.
There is an additional option to wait for completion if the duration is greater than 0, or if the amplitude is 0 and there is a fade time greater than 0.
If the duration is 0 and the amplitude is not 0, the screen will continue shaking until the next screen shake event. To end a screen shake, you can either set the amplitude to 0 in another screen shake event, or use the clear event (this will clear both directions simultaneously).
The edges of the screen are drawn with the color specified at
rendering/environment/defaults/default_clear_color
in the Project Settings.Amplitude is in the range of 0 to 1, with a step value of 0.01. An amplitude of 1 will move the entire size of the screen at its peak.
Frequency has a minimum of 0.1 (a frequency of 0 would cause it to no longer update), and has no upper bound. It is measured in hertz or cycles per second, so higher numbers means faster shaking. This means a value of 1 will move the screen from one side to the other and back to the center in 1 second.
Here is an example of shaking the screen in both directions at different rates, then using the clear event.
2024-10-31.11-46-48.mp4