Hi,
I'm planning on making a top down shooter game on android for android but I can't seem to get the buttons right.
I used GUI libraries like "SUIT" but it's doesn't support hold or I can't configure how. If you know how to make button (doesn't need to be complex just supports hold movement) please help me out. If you want to join me on my "On Android For Android" just tell me.
Thanks in advance.
Buttons on android?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- EngineerSmith
- Prole
- Posts: 38
- Joined: Thu Dec 02, 2021 11:38 am
- Contact:
Re: Buttons on android?
It's pretty much the same as PC; but using different callbacks
https://gist.github.com/EngineerSmith/7 ... ec05c7c095
I threw together a basic example. It is a little over engineered; but by handing all input in one file it is much easier to track and trace where things are going wrong with touch if there is ever a problem.
It supports taps (0.2 seconds) and held down buttons (bottom button resets the top tap button)
With a top down shooter maybe a better path would be to use an on-screen joystick which is just a some simple vector math for movement (although a held down button is probably wanted for things like firing a weapon)
This is only meant to really be an example as there are some issues with it; mainly on things like overlapping buttons. It doesn't include a way to scale buttons either as it's just an example for input (but should be pretty simple with this system as you tell it where the button is and can reset the callback to a new area if the screen resizes or something else, etc. etc.).
https://gist.github.com/EngineerSmith/7 ... ec05c7c095
I threw together a basic example. It is a little over engineered; but by handing all input in one file it is much easier to track and trace where things are going wrong with touch if there is ever a problem.
It supports taps (0.2 seconds) and held down buttons (bottom button resets the top tap button)
With a top down shooter maybe a better path would be to use an on-screen joystick which is just a some simple vector math for movement (although a held down button is probably wanted for things like firing a weapon)
This is only meant to really be an example as there are some issues with it; mainly on things like overlapping buttons. It doesn't include a way to scale buttons either as it's just an example for input (but should be pretty simple with this system as you tell it where the button is and can reset the callback to a new area if the screen resizes or something else, etc. etc.).
- Gunroar:Cannon()
- Party member
- Posts: 1141
- Joined: Thu Dec 10, 2020 1:57 am
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 9 guests