I have been trying to make a class called MyKey with a function called getValue() that returns an int. For example, I want it to return a 1 if the up key is pressed, 2 if the down key is pressed, and a zero if neither is pressed. I would like it to work in an instance like this:
if(MyKey.getValue() == 1)
{
System.out.println("up");
}
(if the above code was in some type of while loop)
The oracle tutorials have only been confusing me even more and I haven't found a request quite like mine on this site. The closest I found was here: How do I check if the user is pressing a key? but that provides a boolean, not an integer, and I could not make it work in the above code after working on it for about an hour.
Thanks!