Sunday, March 4, 2018

2048 Clone in Java, a Journal

I am revitalizing this blog to try and keep track (and think through) design choices with my next project in Programming 2. The first two projects were mostly a flop, and I wondered out loud to my friends if doing this would help me stay on track. This is essentially a rubber-ducky journal. If it helps anyone else, that's awesome, but it is mostly for me.

Our goal is to create a version of the math game 2048 with a themed spin on it. The theme we are assigned as default is Star Wars, but if we can come up with another theme, it will be an extra 5 points.

The original 2048 can be found here: http://2048game.com/
The Star Wars version we are mimicking is here: https://0x0800.github.io/2048-STARWARS/

I'm only starting to set up my class structure, of which I've determined I need at least 3 things.

  • The Game class will handle:
    • Game States - currentGame, gameOver (gameWin and gameLost), restartGame
    • Current score and best overall score
  • The Tile class will handle:
    • Tile borders and whether a tile can combine with another tile
    • Tile values
    • Tile colors/symbols
  • The Board class will handle: 
    • Number of tiles on the board
    • Tracking tile positions
    • Tracking empty tiles
    • Spawning new tiles
There is also an FXML document and a Controller class, since we're using JavaFX and SceneBuilder to create the UI and handle animations, soundFX, and music. Here's a rundown of what the game should have:

  1. Background music
  2. Animations
  3. Sound effects for each piece
  4. Tile must be abstract
  5. Must use an interface
  6. Must correctly keep track of current score, high score, and if the game was won or lost
  7. Bonus: A HELP function that will highlight possible moves
  8. Bonus: A theme other than Star Wars
  9. Bonus: A SWAP (cheat) function to allow for the swapping of two tiles
What I would like to add is an extendable panel that will display the values of the pieces, since we'll be working strictly with symbols. I think I can do so with the Gluon Navigation Drawer, but I'll need to research how it works and make sure it will do what I'm envisioning.

I'll update with my progress as this week goes on. Hopefully, with it being Spring Break for the next week, I'll have plenty of time to get some of the structure hammered out!

7 comments:

  1. Sounds like a fun project! Java can be tricky, but making a 2048 clone is a cool way to learn. I wonder if she made a version with 2048 cupcakes cake too? That would be delicious! Good luck to her!

    ReplyDelete
  2. Sounds like a cool project! I wonder if she'll ever branch out to make other classic games, like a Classic Mahjong game in Java, that'd be awesome! Good luck!

    ReplyDelete
  3. This Java 2048 clone project sounds super fun! Hope she doesn't fall into an equity investment trap when it comes to potential future projects, though! Good luck with the coding! Read More

    ReplyDelete
  4. Sounds like a cool project! I hope she can convert the game replay into a live photo to gif someday! That would be super awesome! Good luck with the coding adventure!

    ReplyDelete
  5. "This Really Awesome Game!" sounds so intriguing! I'm always on the lookout for new games. Hope it's not too complicated, maybe it'll use some AI Image Captioning tech to make it even cooler! Definitely giving it a shot.

    ReplyDelete
  6. Sounds like a super fun coding project! Hope she explores more Java games, maybe even uses some AI Baby Growth Videos tech for her next project! Good luck!

    ReplyDelete
  7. This Java 2048 clone sounds like a blast! Wonder if she's ever tried using AI for a Buzz Cut Hairstyle Prediction app project next? That'd be wild! Good luck with the coding adventures!

    ReplyDelete