T
T
Tera Incognita2021-06-19 23:27:11
Informatics
Tera Incognita, 2021-06-19 23:27:11

Iteration of numbers when pressing the keys, how to implement?

60ce51dc6b550497113839.png

let's say there is a conditionally field

broken into numbers.

123
456
789

movement to the right to the left bottom row is 789 , middle 456 , top 123.

top down from the middle is 852 , 147 , 369

how to implement such control ? as simple as possible?
we have a standard joystick The
60ce52d37f79b470139469.jpeg

question
is how to make the most simple enumeration of numbers on the joystick?
in this field
123
456
789

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-06-19
@Lunali

Well your field is a matrix (two dimensional array).
The current position is x, y.
Pressed the up button - subtracted 1 from y, with the check for the array boundaries. And further by analogy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question