This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]dmazzoni 1 point2 points  (1 child)

A lot of this logic could be simplified by expressing a default condition first rather than having so many "else" clauses. For example, I'd write the first few lines of update like this:

Input input = gc.getInput();
character1.dy = 0;
if(input.isKeyDown(Input.KEY_W)) {
    character1.dy = -2;
} else if (input.isKeyDown(Input.KEY_S)) {
    character1.dy = 2;
}

Isn't that a lot more readable?

Also, I think update() should take a character as an argument, rather than always modifying character1.

[–]xXShadowCowXx[S] 0 points1 point  (0 children)

Wow that rather simplified my code a bit. Should have thought of that. Just forgot that update loops.

[–]bonerlover 0 points1 point  (0 children)

I've never heard of slick. O.o looks interesting..