Dmarsh12fitch / CircutBoardTowerDefense

0 stars 1 forks source link

Add Keyboard Support #2

Closed andystopia closed 2 years ago

andystopia commented 2 years ago

Add Keyboard Control

Motivation

According to @Dmarsh12fitch, there is an arcade at his college which uses a certain layout: image

We should preferably stick to only using the player one controls which is more than enough.

Design Possibilities

Moving the OS Cursor

Move the OS cursor using WASD. Click with a key.

Design Limitations

Simulating A Cursor

So this one is relatively doable, by using the joystick which simulates WASD keys, we can set the cursor to invisible on the unity window and have a sprite (idk what Unity calls them) follow the invisible mouse cursor around. The simulated cursor will act exactly like the OS cursor (as it will just be an overlay for it) when the mouse is moving, and when the mouse is left still, it will instead be moved around by the WASD keys.

Design Benefits

No need to redesign the UI or anything like that, just simulate mouse events using the keyboard. Simulating mouse events using the keyboard means that this process will be purely additive, instead of a just a design change which I'll discuss later on, and additive actions are generally a little easier than re-designs.

Design Drawbacks

Will break all the unity pre-made mouse events, so we will need to implement all the mouse events ourselves. Precursory research shows for all the Collider's, Physics.RayCast seems to be a relatively acceptable substitute that the team could look into.

Implementing a Keyboard UI

It's possible to redesign basically any UI to be controllable solely with a keyboard. So instead of moving continously across the UI by directing a cursor, some focus element will hop around the UI controlled by the keyboard.

Design Benefits

Design Drawbacks

Going to take far longer to implement, like ten times longer, if not longer, to implement this one, and the game devs will not be able to be so free in their creation of the UI.

andystopia commented 2 years ago

Since there's no activity on this post, I've been busily implementing the last option, and hopefully will have a working copy to pull soon.