Purpose

EventHandler is a thread running all the time to handle events(move up, move down, move left, move right, crash) occurs at the client.

Functionality

All the events occurs at the client are stored in the eventQueue. The EventHandler retrives one event at a time, judges what kind of event it is, and the take the corresponding action to that event.

Structure

Variables

eventQueue: This is a SharedQueue used to store the events to be manipulated.

collisionDetector: This is a CollisionDetector used to detect if a collision will occur.

reqSender: This is a ReqSender responsible of sending requests to the server.

Method

addKeyEvent(Integer): This method put the event which is indicated by an integer into the eventQueue.

Modification

The buttons and functions to move a player are added.




[Go to Class Index Table]