Page 1 of 1

AP Computer Science help needed (GridWorld)

Posted: 2008-06-15 01:19am
by Qwerty 42
Okay, so it's my final for my AP Computer Science class, and I've bitten off way more than I can chew. My teacher has told me I can seek help if I need it, and I definitely need it. What I need to do is allow for a character in the Grid to move when the directional arrow keys are pressed. I've tried to add a KeyListener, but the problem seems to be that the Grid has an overriding command to move the grid selection square when the keys are pressed, but I've been completely unable to find it to change it.

http://www.horstmann.com/gridworld/

Any advice, anything at all, that could be given would be hugely appreciated. I know I shouldn't have gotten such a complicated project, but by the time I realized that I was in over my head I was too late. I'd just appreciate some kind soul to help bail me out.

Mercie,

Posted: 2008-06-15 01:31am
by Questor
This may be a stupid question, but could you use the numeric keypad? Or even AWSD?

I'm not that good with Java, so I can't offer any advice on beyond that though.

Posted: 2008-06-15 11:47am
by Qwerty 42
We definitely could, absolutely, the problem is that the program is ignoring any sort of key input, with the exception of the arrows. Since the arrows move the selection square, it seemed easiest to locate whatever was causing that square to move and tell it to move the character instead.