Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

Absolutely!


So I created a series sprites for the different leaf layers of a pine tree.

In Godot, on startup, I decide if a tree will have 3 or 4 leaf layers, scale them from 1 down to 0.5, and color them green.

(The white snow is from a another sprite that I place over top - if I did this again, leaves would have been all one sprite with the snow factored in, but I had originally planned to do some cool stuff with sprite masking - didn't have time to implement this)



From here, I pick a direction to sway the tree in, and select a point for each leaf layer to sway to (the amount the layer sways is based on the size of the leaf layer - the smaller the layer, the further it sways since it corresponds to the top of the tree).


Then I interpolate between the starting and target positions for each leaf layer (cosine function helps the swaying feel more natural than just linear motion between positions).


The period of sway is randomized a little as well.


The 3D effect of this was unintentional, but we loved how it looked when we tested it out, and it saved us from hours of drawing tree sprites by hand (we're not artists lol).


Hope this helps! The explanation is a bit of a mess mostly because the implementation is too!

Thanks for taking the time out to explain this! If it works it works lol. Even though the 3D effect was unintended at first, I was totally fooled. Kudos!