2048FX - The game 2048, built using JavaFX and Java 11

Overview

2048FX

The game 2048 built using JavaFX 16 and Java 17. This is a Java port based on the Javascript version: https://github.com/gabrielecirulli/2048.

Check down below for a screenshot.

Releases

JavaFX Build

You may find binaries available for download, for Windows, Mac and Linux, with Java bundled in. Check successful builds for stable releases.

Screenshot

Building and running

You will need OpenJDK 17 (or newer) installed to build and run the project:

./gradlew run

Create a distribution to your operating system (Windows, Linux, or Mac OS)

You can create a ZIP file that will bundle a small JRE and the game, or you can create a native OS installer (e.g. MSI, DMG, DEB).

To create a ZIP bundle, run:

./gradlew dist

To create a native OS installer, run:

  1. Run ./gradlew dist jpackage

Running using Docker

You can build container image from source code using the Dockerfile and run the containerized game. You have to share the X11 socket with the container. For that you need to install VcXsrv Windows X Server for windows or Xquartz if you're using macOS. Make sure to allow connections from network during setup. On macOS, you'll need to run xhost +127.0.0.1 every time you re-open Xquartz. The final step is to run the container: docker run -it --rm -e DISPLAY=host.docker.internal:0.0 image_name

Feedback / Contributing / Comments

Submit an issue and share your thoughts.

Running with Java 8

If you want to run with Java 8, you can download the tag java-8. New features in the master branch will not be back-ported.

License

The project is licensed under GPL 3. See LICENSE file for the full license.

Comments
  • Fixed bug with parallelTransition (in rare ocasions it finished witho…

    Fixed bug with parallelTransition (in rare ocasions it finished witho…

    …ut being executed none of the children transitions, and tiles in board were missplaced)

    Fixed bug with layout overlay requested when it was already shown.

    opened by jperedadnr 5
  • How to transform into an installer?

    How to transform into an installer?

    I see you have successfully managed to create a zip per platform and that's awesome. How do you go about distributing this as an installer to have a proper lifecycle for install / update / uninstall to your users?

    Thanks!

    opened by simplesteph 3
  • Fixed a typo README.md (gradle task 'distro' does not exist)

    Fixed a typo README.md (gradle task 'distro' does not exist)

    There appears to be a small typo in the readme, which result in a failure to build the jpackage bundle when following the given command line ./gradlew distro jpackage

    opened by fthevenet 1
  • Added styling to tiles and grid like in the original game

    Added styling to tiles and grid like in the original game

    Resized tiles Added animation to hide the tile to be merged, so it doesn't overlap with the new tile Added animation to scale the new random tile Added an AnchorPane to the scene with the GameManager node.

    opened by jperedadnr 1
  • add: link to replit run

    add: link to replit run

    i think it would be pretty cool to let people see how this code works (and edit / preview the program) right in their browser, without any manual downloads or installation. i'm thinking we can add a 'run on repl.it' button, which redirects to something like this:

    image

    opened by hyperupcall 0
  • Refactor build settings

    Refactor build settings

    • use the pluginManagement block in settings.gradle
    • use the plugins block in build file
    • remove unused plugins
    • apply Gluon's javafx plugin
    • configure Azure Pipeline to trigger jlinkZip instead of build.
    opened by aalmiray 0
  • Game2048.java split

    Game2048.java split

    Game2048.java were split to two classes: root stack pane with keyboard and swipe events handlers and scene creation.

    Now it can be shown in a WebFX tab without limitations (it was used WSAD instead arrows workaround for gaming before this patch).

    opened by pjBooms 0
  • Fixed css styling

    Fixed css styling

    • Added css style to higher tiles
    • Fixed Board to load different grid sizes
    • Fixed css to embed the game in other JavaFX application, so it uses its own styleclass selectors.
    opened by jperedadnr 0
  • * Added Best Score, Clock and Pause

    * Added Best Score, Clock and Pause

    ... when the score is greater than the former best score.

    • Added clock to show elapsed time.
    • Added pause control (key P) and white overlay to nearly cover the tiles, showing two buttons (Keep Going and Try Again) to resume the game or start a new one.

    Timer stops during pause or when 2048 tile is reached. It goes on after Keep Going button is clicked. It restarts if Try Again button is clicked.

    opened by jperedadnr 0
  • Remote configuration

    Remote configuration

    After the merge of the last pull request, the build-impl.xml file contains this import:

    but the file is missing (I didn't commit it by mistake), and the project can't be build if you don't add it.

    As no many users will deploy the game with this remote configuration I suggest removing this line instead of adding the file.

    opened by jperedadnr 0
  •  Added SessionManager to save/restore session in a properties file

    Added SessionManager to save/restore session in a properties file

    Use 's' to save (if you have a good position) or 'r' to restore (when the game is over or in a bad position) The file can be edited an used also to test some movements. No cheating allowed!!

    opened by jperedadnr 0
Owner
Bruno Borges
Brazilian Immigrant. Java Champion and Principal Product Manager for Java ☕️ at Microsoft. Previously Oracle, and Azure DevRel team.
Bruno Borges
It is a simple java terminal game. I built it in order to practice my code skills that I obtained while I was learning Java.

Java-terminal-game It is a simple java terminal game. I built it in order to practice my code skills that I obtained while I was learning Java. The ga

Baistan Tashkulov 0 Jan 20, 2022
Jetserver is a high speed nio socket based multiplayer java game server written using Netty and Mike Rettig's Jetlang.It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

Note New version of Jetserver is called Nadron and is in a new netty 4 branch of this same repo. JetServer is a java nio based server specifically des

Abraham Menacherry 1.2k Dec 14, 2022
A game made in Javafx that includes animation, background music, and view leaderboards

A game made in Javafx that includes animation, background music, and view leaderboards. To keep the game alive, a player has to move the ball up/down by pressing the up/down arrow so that the ball only touches different rotating obstacles with the same color. ..

Bijendar Prasad 3 Nov 19, 2022
Java / JavaFX / Kotlin Game Library (Engine)

About JavaFX Game Development Framework Why FXGL? No installation or setup required "Out of the box": Java 8-15, Win/Mac/Linux/Android 8+/iOS 11.0+/We

Almas Baimagambetov 3k Jan 2, 2023
BattleShip-Game - This repository contains the code of the BattleShip (Bataille Navale) game programmed in Java.

Bataille Navale Auteur : SABIL Mohamed Amine Comment générer la documentation ? Placez vous dans le sous-dossier src : pour générer la documentation d

Mohamed Amine SABIL 1 Jan 4, 2022
Snake-Game - A simple snake game written in java.

What's this? A simple snake game written in java. How to play Download the latest release. Ensure that a compatible java runtime is installed (optimal

Patrick260 4 Oct 31, 2022
JavaFX & FXGL Game: Mario; Add New Levels.

FXGL_Mario Game Game Video This project is only used for learning JavaFX and fxgl technology; Pictures, sounds and other materials should not be used

null 8 Nov 7, 2022
Golden Axe (1989) game implemented in java using only standard libraries (Java 2D, Swing, AWT & Java Sound API)

Golden Axe (1989) game implemented in java using only standard libraries (Java 2D, Swing, AWT & Java Sound API), so no external libraries required. Video: https://youtu.be/uevIVLNhQqs

Leo 101 Jul 21, 2022
My Game Engine tested via my Cubecraft Game

My Game Engine tested via my Cubecraft Game Install: mvn -P {your OS name} clean install mvn -P mac clean install mvn -P linux clean install mvn -P wi

null 30 Oct 3, 2022
The game is a 2D side scrolling system, where a player moves left, right, vertically or diagonally to traverse the game.

The game is a 2D side scrolling system, where a player moves left, right, vertically or diagonally to traverse the game.

Ravi Mandal 7 Sep 11, 2022
A simple puzzle game made with Unity to practice the game engine

A simple puzzle game made with Unity to practice the game engine.

Eyüb Salih Özdemir 1 Mar 30, 2022
A basic representation of the 0-player game, "Game-of-Life", a simple example of basic cellular automata

Game-Of-Life-Basic A basic representation of the 0-player game, "Game-of-Life", a simple example of basic cellular automata. A cellular automaton is a

Nikhil Narayanan 5 Oct 27, 2022
An arcade game project which made using java and swing for graphics

Arcade_Game_Development This is an arcade game project which made using java and swing for graphics. Meteor Dodge Here you have to dodge the meteor an

Md. Shakib Shahariar Junayed 1 May 25, 2022
Good ol' PacMan game using Java

Table of contents General info Technologies Setup General info Good ol' PacMan. To play, you just need to use the arrow keys on your keyboard ◀️ ▶️ ??

Lucas Vigier 8 Dec 28, 2022
A game named TikTacToe developed using Java.

Project_TicTakToe This is a game named TikTacToe developed using Java. TIC-TAC-TOE Introduction: In this oop project , we worked on a small game calle

Mahmudur Rahman Tushar 1 Jan 25, 2022
Wordle Solver - Built With Java Spring Boot + React.js

Get a little Wordle help using information theory.

Miguel Valarao 7 Aug 30, 2022
A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge.

A mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge. Originally designed as a MCP Client (called Tephra), it is now being ported t

Peanut 130 Jan 1, 2023
A fairly Simple Game made in Java,You can adopt Pets, name them, and take care of them for XpPoints and level up!

Introducing PetGame! A simple console based game made by @denzven in Java ☕ About the Game PetGame is my first big project in Java, the rules are simp

Denzven 11 Jun 7, 2022
A Java game development framework that deploys to JVM, HTML5, Android and iOS.

PlayN PlayN is a cross-platform Java game development library written in Java that targets HTML5 browsers (via GWT), desktop JVMs, Android and iOS dev

null 237 Dec 9, 2022