COMP 310

BallWar Demo:  Command-dispatching Ballworld with User Interaction

    Current Home  Java Resources  Eclipse Resources

Note:  it is an Honor Code violation to attempt to decompile any supplied code

User Manual for the demo:

BallWar is an extension of the command-dispatching Ballworld and run similarly.   BallWar adds the ability to have "players" that can manually control the movement of certain balls.   The system also has a notion of "scoring" which is just the counting of collisions of a user-controlled ball.

BE SURE TO SELECT BOTH AN UPDATE AND A PAINT STRATEGY BEFORE ATTEMPTING TO MAKE A BALL!

Available Update Strategies:

Note: Unlike the other command-based Ballworld demos ( See links above and below), Straight strategy already has elastic collisions built-in. This is because the architecture that actually runs this demo pre-dates the architectures currently in use in the class, so the update strategies behave a bit differently overall. Please see the other command-based demos for behavior that is closer to that expected in the current class.

Notes on the available update strategies:

 

Available Paint Strategies:

 

Adding Players

  1. Type a player's name into the right hand text field and click the Make Player button. This will instantiate a new player and add it to the drop list below.
  2. A player is always associated with a set of movement keys. When a player is made, it is associated with the selected movement key set from the far right hand drop list. That choice, having been taken, disappears from the drop list.
  3. There are two sets of movement key sets: Arrows+End (arrow keys & End=Stop) and WASDX ( W=Up, A=Left, S=Stop, D=Right & X=Down).
  4. The MoveStrategy associates itself with the selected player when it initializes. Thus it can be controlled by the movement keys.
    1. A MoveStrategy is based on an ANoOpStrategy, so it must be combined with another strategy such as a StraightStrategy in order for the ball to be fully initialized.
    2. Click on the main ball panel area to give it focus so that the movement keys will work. The movement keys will not work if focus is on the control panel area of the frame.
  5. A limitation of the current implementation is that the player can only control the last ball made with a MoveStrategy.
  6. A player is also always has a score., which is displayed on the bottom status bar of the main window.
  7. The ScoreStrategy associates itself with the selected player when it initializes. Whenever a ball with this strategy is involved in a collision, the score is incremented.
  8. If the ball containing the ScoreStrategy is killed, the corresponding player's score is reset to zero.

Click here to download and launch the demo.   Please accept any security requests.

 

[ Back to the Ballworld Demos ]

Trouble Running the Demos?




 

© 2017 by Stephen Wong