• Register

I'm a Programming Teacher. I've played games my whole life. I like supporting games that are multiplattform.

I'm trying to become a Indie Game Developer. I love the old SNES RPG's and pixel art so my game is going to be a Secret of Mana 2 like game :)

RSS My Blogs

Annotation

Khazrak Blog

I've had a hard time think about how the game actually will function (not programming wise).
Use Hitpoints or more like Super Smash Brothers?

I'm not sure which function to implement next.
I started on a abstract way to do button combinations.
That lead me to Annotations in Java.

I could have solved my code by doing lots of if's, but I feelt that there has to be a better way.
So by making a Enum with all the actions buttons can do, a Interface with @ and then connecting the @Interface to the methods of my InputHandler I could invoke (by Java Reflection) the methods by the Enum.

So if I send the Enum Button.SHOOT to the test-method it runs the method in the InputHandler that has that Enum Value in its Annotation and by that can check if the button is pressed.

So I can check if buttons are pressed by checking the Enum's with the test-method, instead of coding every possible combination.

Happy to learn something new! But I haven't mastered it...

Super Refactoring

Super Refactoring

Khazrak Blog
SMASH!

SMASH!

Khazrak Blog
Back again

Back again

Khazrak Blog
Use-cases

Use-cases

Khazrak Blog
Start a group Groups
Indie Devs

Indie Devs

1,715 members Hobbies & Interests

A group dedicated to indie and standalone game development.

Linux Gamers

Linux Gamers

2,970 members Fans & Clans

The group for gamers dedicated to Linux. No matter if game developers or game players all are welcome interested in Linux as a gaming platform.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account:

X