Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

might be THE most oddly specific thing to ask in the world BUT. is it at all possible to automatically center a button inside the viewport when its clicked? i have a scrolling hbox for a menu within a controller_viewport and it has a series of imagebuttons that each open a screen that's centered in the screen, giving the illusion that its simply the initial button changing appearance when clicked. however i forgot to account for mouse options, and that means that when you click one of the imagebuttons when theyre just off in the corner with a mouse, the screen that appears is overlaid over the incorrect imagebutton. was wondering if its possible to have the viewport automatically scroll to the imagebutton when its clicked if its just off to the side, basically.

and another question. i wanted to have some imagebuttons that could be used to scroll to the next item in the list, but im unable to figure out that too. sorry for the long ramble

The first one is really out of the scope of what I can help with for this tool. You can potentially look into nearrect for positioning the new screen appropriately, or style your buttons instead of opening a new screen.

For your second question, you can use buttons that have the Scroll action, if I understood you. Generally if they're using the mouse though, it won't make sense to have buttons which set focus elsewhere. You might be better served having a variable keep track of what button is "selected" and style it based off of selectedness rather than hover state. Then you can execute the appropriate button action based on which button is selected.