Code Monkey home page Code Monkey logo

snakeprotemplate's Introduction

SnakeProTemplate

This is a Snake game I wrote in about two week time for my high school CS project. It uses javax.swing for graphics and java.awt for events.

Directory Structure

This is the src/ directory structure. Code in src/main/java/ is separated into three packages, Controller, Model and View. There are also replaceable resources under src/main/resources, such as sprites and sound files.

There are also test files under src/test/java/. They are JUnit tests to check certain functionalities are working. To use them, check the below instructions.

src directory structure

These are the .sh files under build/

build/*.sh structure

What are the build/scripts/*.sh files?

The .sh files are there to help the user use the code! There are currently four of them:

  • build/scripts/compileEverything.sh is to (re-)compile both the game source and the unit test codes.
  • build/scripts/compileGame.sh only compiles the game source under src/main/java/. Use this to test the game.
  • build/scripts/test.sh runs the unit tests against the code.
    • Usage: build/scripts/test.sh [test1] [test2] [test3] ... or build/scripts/test.sh -all
    • Calling build/scripts/test.sh without any arguments brings up a help menu.
  • build/scripts/clean.sh removes all class files and jar files.
    • Mainly used by me to clean up my compilation files.

How to use the build/scripts/*.sh files

  1. Open Finder, go to /Applications/, go into Utilities/ and find Terminal.app. Open it.
  • An alternative is to open Spotlight and search for Terminal. Hit Return.
  1. If you haven't, download this code as a zip, unzip it and open it in a Finder. Locate the .sh files.
  2. Now in your Terminal, type chmod +x .
  3. Now drag your .sh file into the Terminal. Hit Return.
  4. Repeat step 4 without typing anything before it. Hit Return.
  • If you are using build/scripts/test.sh, this will bring up a help menu. Repeat the drag and drop process following the instructions.
  1. It should compile and run the relevant code now!
  2. If you put any arguments (e.g. a dash -) after the command something.sh, it will not run the compiled code!
  • Example: build/scripts/compileGame.sh -

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.