Quote:Original post by smitty1276
Quote:Original post by Antheus
That's common idiom for Java constants due to lack of namespaces. It saves typing while retaining correct values.
It's still hideous... at LEAST call the interfact GameConstantsConsumer, or GameObject or something. There should be some good way to organize your classes so that classes implement the interfaces they actually need and get the constants at the same time.
Furthermore, such abuses of OO constructs are even less excusable now, since static imports have been part of the language for some time.
Yes, sadly Java community has too much momentum.
Anyway, back to real problem:
if(leftPressed) playerShip.move(Direction.WEST);if(rightPressed) playerShip.move(Direction.EAST);if(upPressed) playerShip.move(Direction.NORTH);if(downPressed) playerShip.move(Direction.SOUTH);
Ironically, your problem stems exactly from the above abuse of interfaces to save typing, something which isn't needed since enum keyword was added.