Ball Game project Documentation Report Filename: Status: Date: Author: Ball Game project.doc draft 22.1.2017 David Hill 265330510 David Hill 13.7.2017 2 (44) Table of contents Ball Game project: Project Model ............................................................................................................................3 Ball Game structure - analysis: Class Diagram [UML]...........................................................................................4 Ball Game structure - design: Class Diagram [UML] .............................................................................................9 Ball Game behaviour - Design: Sequence Diagram ............................................................................................24 States of the Ball: State Machine Diagram .........................................................................................................35 Ball Game requirements: Use Case Diagram ......................................................................................................42 265330510 David Hill 13.7.2017 3 (44) Ball Game project: Project Model The Ball Game project is concerned with developing a video game, where the player attempts to break through a wall by knocking out bricks with a ball, which he or she bounces on his paddle. Status of project model: draft Project manager: David Hill Personnel: Person name Email address Contact information David Hill mailto:[email protected] Park Court Upper Essex Street City 5 B8 6QB Joe Smith mailto:[email protected] www.metacase.com Project model picture: Ball Game project Documentation includes following graphs and subprojects: Graph name Documentation Ball Game structure - analysis Preliminary classes of the game are identified. Ball Game structure - design Ball game structure class diagram displays basic structure of the ball game. Game's idea is to remove all the bricks from the wall by striking them with the ball. Ball Game behaviour - Design This model describes interactions among the Ball game objects during the game. States of the Ball This diagram describes the states of the ball and possible transitions between the states. It reuses events and operations from the class diagram (e.g. Start game, move, calculateNewDirection). Ball Game requirements This model describes the use cases for the ball game application. Generated from MetaEdit+ project documentation report 265330510 13.7.2017 4 (44) David Hill Ball Game structure - analysis: Class Diagram [UML] Graph properties: Model name Status Authors Documentation Ball Game structure - analysis draft Joe Smith Preliminary classes of the game are identified. Diagram picture: Ball Game structure - analysis Graph dictionary Object Ball BallGame Brick Paddle Wall This model describes the class structure of the game identified in the analys... Type of Object Class [UML] Class [UML] Class [UML] Class [UML] Class [UML] Note text Documentation 265330510 David Hill Ball: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Ball +position F F F Ball relationships: In role In relationship : Part : Aggregation Ball links: Link type Decomposition Explosions With objects(s) BallGame In role : Whole Graph's name none none BallGame: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? BallGame T F T BallGame relationships: In role In relationship : Whole : Aggregation : Whole : Aggregation : Whole : Aggregation With objects(s) Wall Ball Paddle In role : Part : Part : Part 13.7.2017 5 (44) 265330510 David Hill BallGame links: Link type Decomposition Explosions Graph's name none none Brick: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Brick F F T Brick relationships: In role In relationship : Part : Aggregation Brick links: Link type Decomposition Explosions With objects(s) Wall Graph's name none none In role : Whole 13.7.2017 6 (44) 265330510 David Hill Paddle: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Paddle F F T Paddle relationships: In role In relationship : Part : Aggregation Paddle links: Link type Decomposition Explosions With objects(s) BallGame In role : Whole Graph's name none none Wall: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Wall F F T Wall relationships: In role In relationship : Part : Aggregation : Whole : Aggregation With objects(s) BallGame Brick In role : Whole : Part 13.7.2017 7 (44) 265330510 David Hill Wall links: Link type Decomposition Explosions 13.7.2017 8 (44) Graph's name none none This model describes the class structure of the game identified in the analys...: Note text Properties: Note text Stereotype This model describes the class structure of the game identified in the analysis phase. This model describes the class structure of the game identified in the analys... relationships: none This model describes the class structure of the game identified in the analys... links: Link type Graph's name Decomposition none Explosions none Sub-objects: Joe Smith: Person Properties: Name E-mail Contact address Joe Smith mailto:[email protected] www.metacase.com +position: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation position public instance F F The ball must include location informtion. 265330510 David Hill 13.7.2017 9 (44) Ball Game structure - design: Class Diagram [UML] Graph properties: Model name Status Authors Documentation Ball Game structure - design draft David Hill Ball game structure class diagram displays basic structure of the ball game. Game's idea is to remove all the bricks from the wall by striking them with the ball. Diagram picture: Ball Game structure - design Graph dictionary Object Type of Object Ball Class [UML] BallGame Brick MovingObject Class [UML] Class [UML] Class [UML] Documentation Ball is the basic element of the game. Player tries to remove bricks by hitting them with the ball. This is the main application class. Single element of the wall. These will disappear, when the ball hits them. MovingObject is an abstract class for all moving components of the ball 265330510 13.7.2017 10 (44) David Hill Paddle TopScore Wall Class [UML] Class [UML] Class [UML] game. Player tries to keep the ball in play by hitting it with the paddle. Stores one of the top scores and the player who achieved it. Walls are generally immobile; the ball bounces back off them giving no points. Ball: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Ball relationships: In role : Part : Specialization Ball links: Link type Decomposition Explosions Ball +void display() , +void calculateNewDirection(MovingObject hitObject) , +void check position() Game F F Ball is the basic element of the game. Player tries to remove bricks by hitting them with the ball. F In relationship : Aggregation : Generalization [UML] Graph's name none States of the Ball With objects(s) Paddle Brick Wall BallGame Wall Paddle Brick MovingObject In role : Part : Part : Part : Whole : Specialization : Specialization : Specialization : Superclass 265330510 13.7.2017 11 (44) David Hill BallGame: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? BallGame #currentScore:int = 0 , -ballsLeft:integer = 3 , +playerName:String +void displayGameOverText() , +void displayPlayersScore() , +void playTune() , +void decrementBalls() , +void initialize() Game F F This is the main application class. F BallGame relationships: In role In relationship : Whole : Aggregation : Whole : Aggregation BallGame links: Link type Decomposition Explosions With objects(s) TopScore Paddle Brick Ball Wall In role : Part : Part : Part : Part : Part Graph's name none none Brick: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Brick +value:int = 1 +void playHitSound() , +void increaseScore() Game F F Single element of the wall. These will disappear, when the ball hits them. F 265330510 13.7.2017 12 (44) David Hill Brick relationships: In role : Part : Specialization Brick links: Link type Decomposition Explosions In relationship : Aggregation : Generalization [UML] With objects(s) Paddle Ball Wall BallGame Wall Paddle Ball MovingObject In role : Part : Part : Part : Whole : Specialization : Specialization : Specialization : Superclass Graph's name none none MovingObject: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? MovingObject +position:Point = [email protected] , -velocity:Point = [email protected] , +extent:Point , colour:ColorValue +void display() , +void move(Point position, int direction) , +void checkHits() Game T F model MovingObject is an abstract class for all moving components of the ball game. F MovingObject relationships: In role In relationship : Superclass : Generalization [UML] MovingObject links: Link type Graph's name Decomposition none Explosions none With objects(s) Wall Paddle Brick Ball In role : Specialization : Specialization : Specialization : Specialization 265330510 13.7.2017 13 (44) David Hill Paddle: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Paddle +maxSpeed +void playHitSound() Game F F Player tries to keep the ball in play by hitting it with the paddle. F Simple symbol? Paddle relationships: In role : Part : Specialization Paddle links: Link type Decomposition Explosions In relationship : Aggregation : Generalization [UML] Graph's name none none With objects(s) Brick Ball Wall BallGame Wall Brick Ball MovingObject In role : Part : Part : Part : Whole : Specialization : Specialization : Specialization : Superclass 265330510 13.7.2017 14 (44) David Hill TopScore: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? TopScore +playerName:String , +score:int = 0 Game F T Stores one of the top scores and the player who achieved it. F TopScore relationships: In role In relationship : Part : Aggregation TopScore links: Link type Decomposition Explosions With objects(s) BallGame In role : Whole Graph's name none none Wall: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Wall relationships: In role : Part Wall F F Walls are generally immobile; the ball bounces back off them giving no points. T In relationship : Aggregation With objects(s) Paddle Brick Ball In role : Part : Part : Part 265330510 13.7.2017 15 (44) David Hill : Specialization Wall links: Link type Decomposition Explosions : Generalization [UML] BallGame Paddle Brick Ball MovingObject : Whole : Specialization : Specialization : Specialization : Superclass Graph's name none none Sub-objects: David Hill: Person Properties: Name E-mail Contact address David Hill mailto:[email protected] Park Court Upper Essex Street City 5 B8 6QB +void display(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation display public instance Overriden from superclass to display a round ball rather than a square +void calculateNewDirection(MovingObject hitObject): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation calculateNewDirection in MovingObject hitObject public instance 265330510 David Hill 13.7.2017 16 (44) in MovingObject hitObject: Parameter Properties: Parameter Data type Direction Default value hitObject MovingObject in +void check position(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation check position public instance Returns the location of the ball. Game: Package Properties: Package name Stereotype Documentation Game modelLibrary Ball game packace include all the components of the ball game application. Because the application is small not other packages are used for categorization. #currentScore:int = 0: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation currentScore int 0 protected instance F F Stores the player's score in the current game. 265330510 David Hill 13.7.2017 17 (44) -ballsLeft:integer = 3: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation ballsLeft integer 3 private instance F F How many balls player has left. +playerName:String: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation playerName String public instance F F Name of the player. +void displayGameOverText(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation displayGameOverText public instance This displays the Game Over text, when game ends. Game can end either when all bricks have disappeared or when player has missed all of his/hers balls. 265330510 David Hill +void displayPlayersScore(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation displayPlayersScore public instance This displays player's current score after the Game over text. +void playTune(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation playTune public instance Plays a tune, when player misses the ball. +void decrementBalls(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation decrementBalls public instance When player misses the ball, decrement balls left 13.7.2017 18 (44) 265330510 David Hill 13.7.2017 19 (44) +void initialize(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation initialize public instance When the game is started +value:int = 1: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation value int 1 public instance F F Value of the brick. When ball hits the brick, value will be added to player's currentScore. +void playHitSound(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation playHitSound public instance When the ball hits a brick or a paddle, it makes a sound. 265330510 David Hill 13.7.2017 20 (44) +void increaseScore(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation increaseScore public instance When then ball hits a brick it will disappear and the value of the brick will be added to player's currentScores. +position:Point = [email protected]: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation position Point [email protected] public class F F Position stores the current location of the top left corner of the moving object in the game. -velocity:Point = [email protected]: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation velocity Point [email protected] private instance F F Stores the direction and speed of the movement. Positive x values are to the right, positive y values up 265330510 David Hill 13.7.2017 21 (44) +extent:Point: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation extent Point public instance F F Moving objects have width and height -colour:ColorValue: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation colour ColorValue private instance F F Colour of the moving object. +void display(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation display public instance Displays the object at its current position. The default is to fill its extent with its colour; subclasses can override for more interesting shapes and effects. 265330510 David Hill 13.7.2017 22 (44) +void move(Point position, int direction): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation move in Point position , in int direction action public instance Is not outside the game field, ie. player has not missed the ball. Move changes the location and direction of the moving object in the game field according to the given position and direction. in Point position: Parameter Properties: Parameter Data type Direction Default value position Point in in int direction: Parameter Properties: Parameter Data type Direction Default value direction int in +void checkHits(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation checkHits public instance Check whether moving object has hit some other object. 265330510 David Hill +maxSpeed: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation maxSpeed public instance F F Maximum speed of the paddle can change during the game +score:int = 0: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation score int 0 public instance F F 13.7.2017 23 (44) 265330510 David Hill 13.7.2017 24 (44) Ball Game behaviour - Design: Sequence Diagram Graph properties: Model name Status Authors Documentation Ball Game behaviour - Design draft David Hill This model describes interactions among the Ball game objects during the game. Diagram picture: Ball Game behaviour - Design Graph dictionary Object :Ball :BallGame :Brick :MovingObject :Paddle Outside actor Type of Object Lifeline object Lifeline object Lifeline object Lifeline object Lifeline object Outside actor Documentation 265330510 13.7.2017 25 (44) David Hill :Ball: Lifeline object Properties: Object name Class Stop? Documentation Ball F :Ball relationships: In role In relationship : Message to calculateNewDirection: Call : Message to calculateNewDirection: Call : Message to check position: Call : Return from : Return : Return from position: Return : Return from : Return :Ball links: Link type Decomposition Explosions With objects(s) :MovingObject :Paddle :MovingObject :MovingObject :MovingObject :MovingObject In role : Message from : Message from : Message from : Return to : Return to : Return to Graph's name none none :BallGame: Lifeline object Properties: Object name Class Stop? Documentation BallGame T :BallGame relationships: In role In relationship : Message from displayPlayersScore: Call : Message from displayGameOverText: Call : Message from move: Call : Message from checkHits: Call : Message to displayPlayersScore: Call : Message to displayGameOverText: Call : Message to decrementBalls: Call : Message to : Call : Return from : Return : Return to : Return :BallGame links: Link type Decomposition Explosions Graph's name none none With objects(s) :BallGame :BallGame :MovingObject :MovingObject :BallGame :BallGame :MovingObject Outside actor Outside actor :MovingObject In role : Message to : Message to : Message to : Message to : Message from : Message from : Message from : Message from : Return to : Return from 265330510 13.7.2017 26 (44) David Hill :Brick: Lifeline object Properties: Object name Class Stop? Documentation Brick F :Brick relationships: In role In relationship : Message to increaseScore: Call : Message to playHitSound: Call : Return from : Return : Return from : Return :Brick links: Link type Decomposition Explosions With objects(s) :MovingObject :MovingObject :MovingObject :MovingObject In role : Message from : Message from : Return to : Return to Graph's name none none :MovingObject: Lifeline object Properties: Object name Class Stop? Documentation MovingObject F :MovingObject relationships: In role In relationship : Message from check position: Call : Message from decrementBalls: Call : Message from playHitSound: Call : Message from playHitSound: Call : Message from increaseScore: Call : Message from calculateNewDirection: Call : Message to move: Call : Message to checkHits: Call : Return from : Return : Return to : Return : Return to : Return : Return to position: Return : Return to : Return : Return to : Return :MovingObject links: Link type Graph's name Decomposition none Explosions none With objects(s) :Ball :BallGame :Brick :Paddle :Brick :Ball :BallGame :BallGame :BallGame :Brick :Ball :Ball :Ball :Brick In role : Message to : Message to : Message to : Message to : Message to : Message to : Message from : Message from : Return to : Return from : Return from : Return from : Return from : Return from 265330510 13.7.2017 27 (44) David Hill :Paddle: Lifeline object Properties: Object name Class Stop? Documentation Paddle F :Paddle relationships: In role In relationship : Message from calculateNewDirection: Call : Message to playHitSound: Call :Paddle links: Link type Decomposition Explosions With objects(s) :Ball :MovingObject In role : Message to : Message from Graph's name none none Outside actor: Outside actor Properties: none Outside actor relationships: In role In relationship : Message from : Call : Return to : Return With objects(s) :BallGame :BallGame Outside actor links: Link type Graph's name Decomposition none Explosions none Sub-objects: David Hill: Person Properties: Name E-mail Contact address David Hill mailto:[email protected] Park Court Upper Essex Street City 5 B8 6QB In role : Message to : Return from 265330510 David Hill 13.7.2017 28 (44) Ball: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Ball +void display() , +void calculateNewDirection(MovingObject hitObject) , +void check position() Game F F Ball is the basic element of the game. Player tries to remove bricks by hitting them with the ball. F +void display(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation display public instance Overriden from superclass to display a round ball rather than a square +void calculateNewDirection(MovingObject hitObject): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation calculateNewDirection in MovingObject hitObject public instance 265330510 David Hill 13.7.2017 29 (44) in MovingObject hitObject: Parameter Properties: Parameter Data type Direction Default value hitObject MovingObject in +void check position(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation check position public instance Returns the location of the ball. Game: Package Properties: Package name Stereotype Documentation Game modelLibrary Ball game packace include all the components of the ball game application. Because the application is small not other packages are used for categorization. BallGame: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? BallGame T F T 265330510 David Hill 13.7.2017 30 (44) Brick: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Brick +value:int = 1 +void playHitSound() , +void increaseScore() Game F F Single element of the wall. These will disappear, when the ball hits them. F +value:int = 1: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation value int 1 public instance F F Value of the brick. When ball hits the brick, value will be added to player's currentScore. +void playHitSound(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation playHitSound public instance When the ball hits a brick or a paddle, it makes a sound. 265330510 David Hill 13.7.2017 31 (44) +void increaseScore(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation increaseScore public instance When then ball hits a brick it will disappear and the value of the brick will be added to player's currentScores. MovingObject: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? MovingObject +position:Point = [email protected] , -velocity:Point = [email protected] , +extent:Point , colour:ColorValue +void display() , +void move(Point position, int direction) , +void checkHits() Game T F model MovingObject is an abstract class for all moving components of the ball game. F +position:Point = [email protected]: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation position Point [email protected] public class F F Position stores the current location of the top left corner of the moving object in the game. 265330510 David Hill 13.7.2017 32 (44) -velocity:Point = [email protected]: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation velocity Point [email protected] private instance F F Stores the direction and speed of the movement. Positive x values are to the right, positive y values up +extent:Point: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation extent Point public instance F F Moving objects have width and height -colour:ColorValue: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation colour ColorValue private instance F F Colour of the moving object. 265330510 David Hill 13.7.2017 33 (44) +void display(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation display public instance Displays the object at its current position. The default is to fill its extent with its colour; subclasses can override for more interesting shapes and effects. +void move(Point position, int direction): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation move in Point position , in int direction action public instance Is not outside the game field, ie. player has not missed the ball. Move changes the location and direction of the moving object in the game field according to the given position and direction. in Point position: Parameter Properties: Parameter Data type Direction Default value position Point in in int direction: Parameter Properties: Parameter Data type Direction Default value direction int in 265330510 David Hill +void checkHits(): Operation [UML] Properties: Operation name Parameters Return type Overridability Stereotype Visibility Operation type Preconditions Postconditions Body Documentation checkHits public instance Check whether moving object has hit some other object. Paddle: Class [UML] Properties: Class name Attributes Operations Package Abstract? Persistent? Stereotype Overridability Role Parameters Constraints Invariant Derivation rules Responsibility Documentation Simple symbol? Paddle +maxSpeed +void playHitSound() Game F F Player tries to keep the ball in play by hitting it with the paddle. F +maxSpeed: Attribute [UML] Properties: Name Data type Default value Stereotype Visibility Scope Access Derived? Persistent? Constraints Documentation maxSpeed public instance F F Maximum speed of the paddle can change during the game 13.7.2017 34 (44) 265330510 David Hill 13.7.2017 35 (44) States of the Ball: State Machine Diagram Graph properties: Model name Status Authors Documentation States of the Ball frozen Joe Smith This diagram describes the states of the ball and possible transitions between the states. It reuses events and operations from the class diagram (e.g. Start game, move, calculateNewDirection). Diagram picture: States of the Ball Graph dictionary Object This diagram describes the states of the ball and possible transitions betwee... Start Behind the paddle Type of Object Note text Start State [UML] Hits a brick State [UML] Hits a wall State [UML] Hits the paddle State [UML] Initialized State [UML] Documentation When player misses the ball, the number of balls left decreases by one and a tune is played. When the ball hits a brick the Hit sound is played, the brick's value is added to the player's scores and new direction for the ball is calculated. When the ball hits the wall, a new direction for the ball is calculated. When ball hits the paddle the Hit sound is played, and new direction for the ball is calculated. In the beginning the direction of the ball is initialized to 0 which means movement directly up. 265330510 13.7.2017 36 (44) David Hill Moving State [UML] Play a game Stop State [UML] Stop When the game has begun, the ball is mostly moving with the current direction and speed. This diagram describes the states of the ball and possible transitions betwee...: Note text Properties: Note text This diagram describes the states of the ball and possible transitions between the states. It reuses events and operations from the class diagram (e.g. initialize, move, calculateNewDirection). Stereotype This diagram describes the states of the ball and possible transitions betwee... relationships: none This diagram describes the states of the ball and possible transitions betwee... links: Link type Graph's name Decomposition none Explosions none Start: Start Properties: none Start relationships: In role In relationship : From initialize: Transition [UML] Start links: Link type Decomposition Explosions With objects(s) Initialized In role : To Graph's name none none Behind the paddle: State [UML] Properties: State name Internal actions Documentation Symbol transparent? Behind the paddle entry / playTune , entry / decrementBalls(1, bar) When player misses the ball, the number of balls left decreases by one and a tune is played. F Behind the paddle relationships: In role In relationship : From decrementBalls: Transition [UML] : From : Transition [UML] : To : Transition [UML] With objects(s) Initialized Stop Moving In role : To : To : From 265330510 David Hill 13.7.2017 37 (44) Behind the paddle links: Link type Graph's name Decomposition none Explosions none Hits a brick: State [UML] Properties: State name Internal actions Documentation Symbol transparent? Hits a brick entry / playHitSound , entry / increaseScore(1) , exit / calculateNewDirection When the ball hits a brick the Hit sound is played, the brick's value is added to the player's scores and new direction for the ball is calculated. F Hits a brick relationships: In role In relationship : From : Transition [UML] : To : Transition [UML] Hits a brick links: Link type Decomposition Explosions With objects(s) Moving Moving In role : To : From Graph's name none none Hits a wall: State [UML] Properties: State name Internal actions Documentation Symbol transparent? Hits a wall entry / calculateNewDirection When the ball hits the wall, a new direction for the ball is calculated. F Hits a wall relationships: In role In relationship : From : Transition [UML] : To : Transition [UML] Hits a wall links: Link type Decomposition Explosions With objects(s) Moving Moving In role : To : From Graph's name none none Hits the paddle: State [UML] Properties: State name Internal actions Documentation Symbol transparent? Hits the paddle entry / playHitSound , entry / calculateNewDirection When ball hits the paddle the Hit sound is played, and new direction for the ball is calculated. F Hits the paddle relationships: In role In relationship : From : Transition [UML] With objects(s) Moving In role : To 265330510 13.7.2017 38 (44) David Hill : To : Transition [UML] Moving : From Hits the paddle links: Link type Graph's name Decomposition none Explosions none Initialized: State [UML] Properties: State name Internal actions Documentation Initialized Symbol transparent? In the beginning the direction of the ball is initialized to 0 which means movement directly up. F Initialized relationships: In role In relationship : From : Transition [UML] : To initialize: Transition [UML] : To decrementBalls: Transition [UML] Initialized links: Link type Decomposition Explosions With objects(s) Moving Start Behind the paddle In role : To : From : From Graph's name none none Moving: State [UML] Properties: State name Internal actions Documentation Symbol transparent? Moving do / move When the game has begun, the ball is mostly moving with the current direction and speed. F Moving relationships: In role In relationship : From : Transition [UML] : From : Transition [UML] : From : Transition [UML] : From : Transition [UML] : To : Transition [UML] : To : Transition [UML] : To : Transition [UML] : To : Transition [UML] Moving links: Link type Decomposition Explosions With objects(s) Hits a wall Behind the paddle Hits the paddle Hits a brick Hits the paddle Hits a wall Initialized Hits a brick Graph's name none none In role : To : To : To : To : From : From : From : From 265330510 David Hill Play a game: State [UML] Properties: State name Internal actions Documentation Symbol transparent? Play a game T Play a game relationships: none Play a game links: Link type Decomposition Explosions Graph's name none none Stop: Stop Properties: none Stop relationships: In role In relationship : To : Transition [UML] Stop links: Link type Decomposition Explosions With objects(s) Behind the paddle Graph's name none none Sub-objects: Joe Smith: Person Properties: Name E-mail Contact address Joe Smith mailto:[email protected] www.metacase.com entry / playTune: Internal activity Properties: Activity Activity label Arguments Documentation playTune entry entry / decrementBalls(1, bar): Internal activity Properties: Activity Activity label Arguments Documentation decrementBalls entry param1=1 , param2=bar In role : From 13.7.2017 39 (44) 265330510 David Hill param1=1: Argument Properties: Argument Parameter 1 in dataType param1=2 in dataType param1=2: Parameter Properties: Parameter Data type Direction Default value param1 dataType in 2 param2=bar: Argument Properties: Argument Parameter bar out dataType param2=defaultValue out dataType param2=defaultValue: Parameter Properties: Parameter Data type Direction Default value param2 dataType out defaultValue entry / playHitSound: Internal activity Properties: Activity Activity label Arguments Documentation playHitSound entry entry / increaseScore(1): Internal activity Properties: Activity Activity label Arguments Documentation 1: Argument Properties: Argument Parameter 1 increaseScore entry 1 13.7.2017 40 (44) 265330510 David Hill exit / calculateNewDirection: Internal activity Properties: Activity Activity label Arguments Documentation calculateNewDirection exit entry / calculateNewDirection: Internal activity Properties: Activity Activity label Arguments Documentation calculateNewDirection entry entry / playHitSound: Internal activity Properties: Activity Activity label Arguments Documentation playHitSound entry entry / calculateNewDirection: Internal activity Properties: Activity Activity label Arguments Documentation calculateNewDirection entry do / move: Internal activity Properties: Activity Activity label Arguments Documentation move do 13.7.2017 41 (44) 265330510 13.7.2017 42 (44) David Hill Ball Game requirements: Use Case Diagram Graph properties: Model name Status Authors Documentation Ball Game requirements draft Joe Smith This model describes the use cases for the ball game application. Diagram picture: Ball Game requirements Graph dictionary Object Player Ball game Play a game View high scores Type of Object Actor [UML] System [UML] Use case [UML] Use case [UML] Documentation Player who plays the ball game or views the high scores. The user can play a game which a traditional ball game: player moves the paddle and tries to remove the bricks from the field by hitting them with the ball. The player has three balls per game. Scores of the best games and stored automatically and the user can view top 10 list. The list includes scores and player names. Player: Actor [UML] Properties: Actor name Documentation Player Player who plays the ball game or views the high scores. Player relationships: In role In relationship : Association role : Association [UML] : Association role : Association [UML] Player links: Link type Decomposition Explosions Graph's name none none With objects(s) Play a game View high scores In role : Association role : Association role 265330510 13.7.2017 43 (44) David Hill Ball game: System [UML] Properties: System name Documentation Ball game Ball game relationships: none Ball game links: Link type Decomposition Explosions Graph's name none none Play a game: Use case [UML] Properties: Use case name Attributes Operations Documentation file Extension points Documentation Play a game The user can play a game which a traditional ball game: player moves the paddle and tries to remove the bricks from the field by hitting them with the ball. The player has three balls per game. Play a game relationships: In role In relationship : Association role : Association [UML] Play a game links: Link type Decomposition Explosions With objects(s) Player In role : Association role Graph's name none Ball Game behaviour - Design View high scores: Use case [UML] Properties: Use case name Attributes Operations Documentation file Extension points Documentation View high scores Scores of the best games and stored automatically and the user can view top 10 list. The list includes scores and player names. View high scores relationships: In role In relationship : Association role : Association [UML] With objects(s) Player In role : Association role 265330510 David Hill View high scores links: Link type Graph's name Decomposition none Explosions none Sub-objects: Joe Smith: Person Properties: Name E-mail Contact address Joe Smith mailto:[email protected] www.metacase.com 13.7.2017 44 (44)
© Copyright 2026 Paperzz