v0.3.4 - Controller and Mobile Support
Mutant Mayhem - Controller and Mobile Support
Controller Support
The decision was made to add controller support first, as it seemed logical to tie the mobile control into the framework it would require. I ended up creating a CursorManager that controls a custom cursor (not the mouse or pointer). There was learning involved in order to trigger click events through the Event system, and I also added an option slider to control the custom cursor speed (when controlled by joystick). There is also an acceleration to the custom cursor, for easier fine movements.
I created an InputManager mainly to detect and store the Last Used Device. This is used to update UI and controls.
I also added 2 different aim modes for joystick control, one where the aiming is instant and tied to the joystick direction and and input magnitude. The other is just the custom cursor moving around like a mouse pointer would, controlled by joystick movements.
I created a DeviceTextSwitcher and DeviceImageSwitcher script which can be attached to things. It has settings for changing entire text or subtext within a string depending on which input device is being used (keyboard/mouse, gamepad, touchscreen).
Mobile Support
I was never sure if mobile would really work for my game, performance and design-wise. But, I wanted to try it and find out, and here we are with a playable mobile game! Most of the groundwork was done by the Controller Support update, but there was a large list of small details to change and adjust for different screen aspect ratios.
I created 2 Virtual Joysticks for movement and aiming. The movement joystick can be double tapped to sprint.
The aim joystick is it's own beast. I ended up putting 3 zones onto the joystick handle, where the left is for shooting, right for melee, and the center zone is for just aiming. This has proven to work fairly well, but an improvement would be to have a deadzone area around the joystick, so the player can tap off the joystick area and still trigger shots/melee attacks.
Lots of UI adjustments were to to accommodate small and large screens of different aspect ratios. Things are looking pretty good so far!
I created a DeviceRectAdjuster script to handle scaling and moving UI elements depending on which device is used and what the screen aspect ratio is. This first came-to-be when i needed to scale down the virtual joysticks on iPad screen ratio, since the project is set to scale with screen height, they ended up being too big.
Tying the virtual joysticks into the game was easy after setting up the joystick controls for controller support.
Next, I added the ability to just tap anywhere in the world to aim, shoot, or melee. The player must use 1, 2 or 3 fingers respectively, where the first finger is the aim point. This is a little rough due to not being able to see the screen. I might refine this later.
Adding the world-tap actions was a trick as well, I ended up creating a TouchManager to log and store all touches and assigned them a purpose like Aim, Shoot, Melee, UI, BuildMenu, None. This allowed me to have custom control over different taps on the screen depending where they landed.
Final Note
I spent a good amount of time smoothing these touch systems out in order to accommodate a smooth play experience, but I'm not happy with how difficult the game is to play on touchscreen, and I have a large phone. Some extra changes or options may be necessary to make things better.
Files
Get Mutant Mayhem
Mutant Mayhem
2D top down shooter with base-building and roguelite mechanics
Status | In development |
Author | AiryShelf - KamJam Games |
Genre | Action, Shooter, Strategy, Survival |
Tags | 2D, base-building, Bullet Hell, Difficult, Top-Down, Unity |
Languages | English |
More posts
- v0.3.6 - Bats, Mines, and Razor Wire19 days ago
- v0.3.2 - Construction and Attack Drones41 days ago
- v0.2.1 - Planets and More79 days ago
- First Public DemoOct 27, 2024
Leave a comment
Log in with itch.io to leave a comment.