Giter Club home page Giter Club logo

javascript-slider-puzzle's Introduction

Slider Puzzle

Completing this assignment depends on knowing:

  • Basic JavaScript: variables, functions, conditionals
  • jQuery: DOM traversal, adding/removing items from the DOM, setting/getting attributes, & iteration

Intro

In this assignment we will make an image slider puzzle using jQuery. Open the HTML file in a browser and you’ll see the puzzle, but it doesn’t do anything yet. You will need to set up the behavior to allow the pieces of the puzzle to move into the open space when the image is clicked on. When the images are all in the correct spot, the puzzle should update to show a green win border around the puzzle and replace the empty image with the missing image piece. You should also disable the click behavior.

Requirements

Puzzle Behavior:

  • Images can only move left, right, up, or down
  • Images can only move into the open spot in the puzzle (cell with the "empty" image)
  • Show a help message if clicks on the “empty” image tile or an image tile that cannot be moved. The message should explain what they did wrong and what to do instead.
  • When the puzzle is solved (images are all in the correct order from 1-15):
    • replace the empty image with the missing image piece (image 16)
    • change the puzzle border from brown to green by applying the win style to the puzzle grid
    • disable the click behavior that attempts to slide the image pieces
  • Add a reset button to the page that will mix up the puzzle so that it can be solved again

JavaScript Code:

  • Use the module pattern to keep things out of global scope
  • Use functions to break down the functionality into small tasks
  • Practice good coding standards with clear variable and function names, use $ for variables that will hold jQuery objects, use ES6 let and const instead of var

Extras

The following are extras that you can add to the working game. Don't work on extras until the base game is functional!

Help

Add hint buttons:

  1. A button to show/hide the completed image so that the player can see what the final result looks like.
  2. A button to show/hide the image numbers (found in alt text) over the images. The image number is found in the alt text for the image. Do NOT show anything for the empty image.

Extraordinary Win

Do something extra special when the puzzle is solved. Something more than a “You win” message or changing the color. Perhaps floating balloons or confetti, sound, or shooting rainbows. We haven’t really talked about these things, so you’ll have to do some research for this one. Be sure to only use resources you have rights to use and add any attributions to a footer in the HTML.

Additional Puzzle

Add additional images to create different puzzles to solve. Provide a list so the player can choose between the available puzzles. This puzzle is made from a photo I took of my cats and chopped up using MS Paint - very low tech. Don't infringe on any copyrights here. Use your own "safe-for-work/school" images or provide attribution for ones that allow free non-commercial use.

javascript-slider-puzzle's People

Contributors

mbmosman avatar

Watchers

 avatar  avatar

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.