HoverShake2D

An asset by SlushyGames
The page banner background of a mountain and forest
HoverShake2D hero image

Quick Information

0 ratings
HoverShake2D icon image
SlushyGames
HoverShake2D

This is a simple script/class that you can use on a node that inherits Node2D (e.g. Sprite). This script is an easy way to add a nice hover or shake effect to your nodes without the need of any additional child nodes.var hover_shake = HoverShake2D.new()In your node's _ready() function, initialize the behavior using your node as its target:func _ready(): hover_shake.init(self)Then, during your node's _update() function, simply pass the delta into the behavior:func _process(delta): hover_shake.update(delta)Now your node is hovering! Or shaking, if you use extra options:hover_shake.init(self, "random", 0, 2, 200) // fast shake - Second parameter is starting direction, possible values are "random", "up", "down", "left", "right" (default "random") - Third parameter is vertical distance of the hover in pixels (0 for no hover, default 15) - Fourth parameter is horizontal distance of the shake in pixels (0 for no shake, default 0) - Fifth parameter is speed of the hover/shake (default 10)That's it! Super easy hover, super simple shake. Enjoy!

Supported Engine Version
3.2
Version String
1.0
License Version
CC0
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

HoverShake2D

A simple but effective way to add a hover or a shake effect to any node that extends Node2D using the Godot Engine v3.2. Doesn't make use of any child nodes.

This is a simple script/class that you can use on a node that inherits Node2D (e.g. Sprite). This script is an easy way to add a nice hover or shake effect to your nodes without the need of any additional child nodes.

var hover_shake = HoverShake2D.new()

In your node's _ready() function, initialize the behavior using your node as its target:

func _ready():
hover_shake.init(self)

Then, during your node's _update() function, simply pass the delta into the behavior:

func _process(delta):
hover_shake.update(delta)


Now your node is hovering! Or shaking, if you use extra options:

hover_shake.init(self, "random", 0, 2, 200) // fast shake

- Second parameter is starting direction, possible values are "random", "up", "down", "left", "right" (default "random")
- Third parameter is vertical distance of the hover in pixels (0 for no hover, default 15)
- Fourth parameter is horizontal distance of the shake in pixels (0 for no shake, default 0)
- Fifth parameter is speed of the hover/shake (default 10)

That's it! Super easy hover, super simple shake. Enjoy!

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
HoverShake2D icon image
SlushyGames
HoverShake2D

This is a simple script/class that you can use on a node that inherits Node2D (e.g. Sprite). This script is an easy way to add a nice hover or shake effect to your nodes without the need of any additional child nodes.var hover_shake = HoverShake2D.new()In your node's _ready() function, initialize the behavior using your node as its target:func _ready(): hover_shake.init(self)Then, during your node's _update() function, simply pass the delta into the behavior:func _process(delta): hover_shake.update(delta)Now your node is hovering! Or shaking, if you use extra options:hover_shake.init(self, "random", 0, 2, 200) // fast shake - Second parameter is starting direction, possible values are "random", "up", "down", "left", "right" (default "random") - Third parameter is vertical distance of the hover in pixels (0 for no hover, default 15) - Fourth parameter is horizontal distance of the shake in pixels (0 for no shake, default 0) - Fifth parameter is speed of the hover/shake (default 10)That's it! Super easy hover, super simple shake. Enjoy!

Supported Engine Version
3.2
Version String
1.0
License Version
CC0
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers