5/16/2023 0 Comments Javafx game source code![]() * Spawns a 2 (or 4) at an empty space very time a move is made */ * Returns the board as a String - used in the GUI */ * Prints out the board onto the console - for testing purposes */ * Finds the highest tile on the board and returns it */ ![]() * Getter method that returns the score */ * Getter method that returns the board */ * Constructor for the Board - sets up a matrix with specified grid size */ * Default constructor for the Board - sets up a 4x4 matrix */ Most of the logic is also here, the class providing methods for spawning 2's and 4's at random locations, moving up, down, left and right, and letting players know when the game is over. I divided the game up into 3 classes: Board, Tile and Game.ĭescription: The Board class deals with the gameboard, setting up an array of 'Tile' elements, getting the current score and the highest tile, and putting the array in a string (to be used later in 'Game'). I uploaded all my code onto GitHub - check it out here:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |