Giter Club home page Giter Club logo

bhavyac16 / plants-vs-zombies Goto Github PK

View Code? Open in Web Editor NEW
128.0 2.0 48.0 89.52 MB

CSE201: Advanced Programming Final Project | Re-implemented the strategy video game, Plants 🌱🌡 vs. Zombies πŸ§Ÿβ€β™‚οΈπŸ§Ÿβ€β™€οΈ , originally developed by PopCap Games | Working demo: https://www.youtube.com/watch?v=AgMRkRLPeFU

License: GNU General Public License v3.0

Java 99.80% Shell 0.20%
javafx-games javafx-project plants-vs-zombies game-development uml-diagrams javafx-11 java-11 java-application

plants-vs-zombies's Introduction

Plants-Vs-Zombies 🌱🌡 Vs πŸ§Ÿβ€β™‚οΈπŸ§Ÿβ€β™€οΈ

Details

Created by: Bhavya Chopra and Sonali Singhal

This is a clone of the strategy video game, Plants vs. Zombies, originally developed by PopCap Games.

A working demo of the game can be seen here.

Made as a part of project in Advanced Programming course at IIIT-Delhi.

Uses Java and JavaFx.

Features

  • 5 Levels with increasing difficulties
  • 2 Themes (Night Mode and Day Mode)
  • Plants Available: Sunflower, Pea Shooter, Cherry Bomb, Walnut, Repeater, Jalapeno
  • Zombies Available: Normal Zombie, Conehead Zombie and Buckethead Zombie
  • Almanac: Displays details and attack methods and power of each zombie and plant
  • Shovel: Tool to shovel plants out of the grid
  • Save Game and Restart Game options: User can save multiple game states, and reload them, or delete game progress
  • Cool sound effects for all lawn interactions
  • Lots of fun :P

Implementation

  • Navigation is via FXML files
  • Load Game menu is used to load multiple saved states of the game. Everytime a user saves a game, the game state is given an id, which is displayed as Game_ID along with the level on which the game was saved. 'Delete all progress' removes all the saved game states.
  • Level Menu can be used for starting a new game from the unlocked levels. A user cannot play a new level if they haven't won the all previous levels.
  • Exit Game saves all the progress and exits the game.
  • In Game Menu: Allows the user to save the game, restart the game or exit to main menu.
  • Levels become harder as the user progresses through the game. The cone and bucket zombies start appearing in subsequent levels, their frequency also increases.
  • Different menus on winning and losing a game. Winning tells the user about the new plant unlock and losing menu gives the message β€œZombies ate your brains”
  • After placing a plant, a plant is locked for sometime before it can be planted again.
  • The shovel can be used to remove a plant from the lawn.
  • Sound effects have been added for all interactions on the lawn to enhance the experience.
  • The users can also choose between the day and the night mode. Unlike the day mode, no sun tokens fall from the sky in the night mode, and sunflowers are the only source of sun tokens.

Design Patterns

  1. Singleton: For the database and for shovel feature, as we need only one reference through out the game.
  2. Iterator - To ensure that Plant, Zombie and Lawnmower lists are accessed in a synchronized way.
  3. Facade for menu based implementation

Screenshots from the game

alt_text alt_text alt_text alt_text alt_text alt_text

How To play

Executing the JAR File

To play the game, the following steps can be followed:

  1. Clone this repository using the command: git clone https://github.com/BhavyaC16/Plants-Vs-Zombies.git
  2. cd into the directory Plant-Vs-Zombies-JAR using: cd Plants-Vs-Zombies/Plant-Vs-Zombies-JAR
  3. Download the JavaFX SDK 11.0.2 from here, depending on your platform. Unzip and situate the folder javafx-sdk-11.0.2 in Plants-Vs-Zombies/Plant-Vs-Zombies-JAR
  4. Execute the command ./PlantsVsZombies.sh . Alternatively, execute the command java --module-path ~/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.media -jar PlantVsZombies.jar
    (Note: --module-path specifies the path to your JavaFX SDK 11 lib folder. The variable LIB_PATH in PlantsVsZombies.sh holds the path to the lib folder, and can be updated accordingly.)

Code and assets

Path to code: PlantVsZombies/src/sample
Path to Images and sounds: PlantVsZombies/src/sample/assets

License

GNU General Public License v3.0

You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions.

plants-vs-zombies's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

plants-vs-zombies's Issues

Add night theme to game

  1. Giving the user an option at the home page to switch between night and day mode
  2. Changing the lawn image to src/sample/assets/lawn_night.jpg
  3. Disable dropping suns

Fail to build jar file

Hello. I love this game but is imposible to play it on arm64 macOS. I try tu buid this
So I use iTerm

git clone https://github.com/BhavyaC16/Plants-Vs-Zombies.git

cd PlantsVsZombies/Plant-Vs-Zombies-JAR

#Then copy javafx-sdk-17.0.2 for arm64 to Plant-Vs-Zombies-JAR folder

java --module-path ~/javafx-sdk-17.0.2/lib/ --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.media -jar PlantVsZombies.jar

Always got error: Error: Unable to access jarfile PlantVsZombies.jar

Please help.

Where is the JAR file?

Hi team,
the Plants-Vs-Zombies-JAR subdirectory doesn't contain a JAR file. Can you post the build instructions on how I can compile/build that file?
Thanks.

Pulish a .jar as realise.

Apps seems incredible ! You should publish a realise so that user can download it in 1 clic & launch it with java -jar PvZ.jar

Plant-Zombie Interaction on Lawn

Bugs in Plant-Zombie interaction on lawn:

  1. Zombie continues to eat plant despite plant being shovelled
  2. If a plant is being eaten by multiple zombies, only 1 zombie is able to move ahead after the plant is killed.

In both these cases, the chomping sound continues as well

(Hint: might have to think of an alternative implementation for the eatPlant() method in Zombie and coneZombie classes)

Game assets

I wonder if the game assets should be downloaded from a game demo (for instance, this one), instead of having them inside the repository. Another option is to include them in a separated file as a Github release (so the game can download it automatically from there).

Create JAR file

  • Executing the JAR file results in MediaException: MEDIA_UNAVAILABLE for all music files.
  • Image assets are not loading. Only those images whose paths have been specified in the scenebuilder are being loaded upon execution of JAR file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.