Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

Not sure if you mean the scrolling background or scrolling the tree by dragging with the mouse (probably the latter) so I'll explain both.

For the background it's a tilled image on a TextureRect with a scrolling shader ( UV.x += TIME * speed; UV.y += TIME * speed;  in vertex())

For the dragging, it's a bit more complicated but I put my tree inside a parent of type ScrollContainer, hide the scrollbar, then added custom code that save the mouse position when pressing left click, then if left click is held, compare the current position to the saved one and add the difference to ScrollContainer.scroll_horizontal and ScrollContainer.scroll_vertical 

Here's the code with the drag and zoom if you wanna take a look! :)
https://pastebin.com/dpp1zpzW

Ay thanks! That actually makes sense. I was looking for a similar thing, scrolling in menus, in an old game of mine but never quite got around to figuring it out...