This is a JavaFX-based farm simulation game where the player can plant, harvest, and sell wheat. The game uses a graphical user interface (GUI) to provide an engaging and interactive experience. The player can plant wheat, harvest it when ready, and sell it for money. The goal is to manage the farm by growing wheat and selling baked goods such as bread loaves, slices, and cakes, all while tracking progress through the GUI.
- Farm Management: Plant, harvest, and sell wheat.
- Upgrade System: Sell wheat and baked goods (bread loaves, slices, and cakes).
- Graphical Interface: Uses JavaFX for an intuitive GUI with buttons, labels, canvas elements, and images.
- State Tracking: Keeps track of farm resources (wheat, money, bread) and progress.
This class serves as the primary view for the game. It sets up the graphical interface and allows the player to interact with the game through various GUI components:
- Buttons for planting and harvesting wheat.
- Canvas and labels to display the current state of the farm (number of wheat, money, baked goods).
- Event handlers to trigger actions when the player interacts with the interface.
- It communicates with the model classes (
Farm
andWheat
) to update and track the game's state.
This is the main model class that handles the game logic and state:
- Tracks the state of the farm: Number of wheat, money, bread slices, loaves, and cakes.
- Methods for planting, harvesting, and selling: Handles all the logic for modifying farm resources and interacting with wheat.
- Associates with Wheat class: Uses an array of
Wheat
objects to represent the wheat planted on the farm.
This class represents individual wheat objects in the game:
- Growth and Harvest Logic: Each wheat object tracks its growth level and determines when it can be harvested.
- Encapsulates wheat properties: Manages the
growthLevel
andharvestFlag
variables to determine harvest readiness.
- Plant Wheat: Click the "Plant" button to plant a new wheat seed.
- Harvest Wheat: Click the "Harvest" button once the wheat has grown to harvest it.
- Sell Wheat and Goods: Sell harvested wheat and bake bread or cakes with the resources collected to earn money.
- Buttons: Interact with the game by planting, harvesting, and selling wheat.
- Canvas: Display the farm's graphical state.
- Labels: Show current wheat count, money, and baked goods.
- Java 8 or higher
- JavaFX SDK
- Clone this repository.
- Open the project in your preferred IDE (e.g., IntelliJ, Eclipse).
- Run the
FarmGame.java
file.
- Brendan Dileo - 000879513