Simple Interactive Foliage 2D - Godot
Hi Guys,
I'm trying to make a very simple interactive foliage project, maybe the code I wrote is not perfect but I'm quite happy to be able to make it and I can use it in my next project.
I used a shader from 2D wind sway, with a slight modification by adding the code:
The skew variable is used to adjust the skew of the texture based on the player's speed when it hits the grass. You can see for yourself the project I made by downloading it
I share the source code of this game, please download it without any conditions. I will be happy if you give feedback below
Status | Released |
Platforms | HTML5 |
Author | Sarapan Malam Games |
Genre | Platformer |
Tags | 2D, Godot, interactive-foliage, Shaders, sourcecode |
Download
Download NowName your own price
Click download now to get access to the following files:
Source Code.zip 42 kB
Comments
Log in with itch.io to leave a comment.
Hey, I'm very glad to you and _Raptor that gave tips to how to put this to work on godot 4.0. Been trying all day to do this for my project and I finally got it!, Thx to you all.
Thank god for old forum posts, this saved me a headache, thank you. I adjusted it to make it work with Godot 4, and it works great!
If anyone is reading this looking to do the same:
Now I'll figure out how to do this but for singular tiles in a tileset...
By "your player's speed value" you mean velocity.x?
Just downloaded it to look at the code, because I implemented a similar shader myself recently.
Your implementation of just adding the velocity based skew on top of the foliage swaying shader behaves nicely and is easy to read :D
Mantap dah! Just into Godot and thinking of creating pixel game with this kind of interactive foliage shader.
Great work! I think this can be useful for my game, I currently can't get it to apply to each grass blade individually as they all act in a unit, so any tips would be greatly appreciated <3
No spoilers 💀
Thanks a lot for this! been looking for a shader like this for a while. Fit perfectly to my game!
This is pretty good