Coder Social home page Coder Social logo

project-1's Introduction

Project #1: Simple Pac-Man

This game is inspired by the iconic video game, PAC-MAN.

How to play?

Instructions:

  • Use the arrow keys ⬆️ ⬇️ ⬅️ ➡️ or swipe to move Pac-Man around the maze.
  • Complete the level by eating all the dots.
  • Avoid the ghosts! If they catch you, you will lose a life.
  • You only have 3 lives. Be careful!

URL:

Gameboard

Draft:

Final:

Game Logic

createWall (left, top, width, height)

  • Create walls on the gameboard

createDot (left, top)

  • Create dots on the gameboard

hitWall (character)

  • Check if the character (Pac-Man, ghost) hits the wall (collision function)

hitGhost ()

  • Check if Pac-Man hits the ghost (collision function)

pacmanMovement ()

  • Pac-Man will change direction when the arrow key is pressed or when a swipe is detected
  • Pac-Man's position is rounded to the nearest multiple of 40 (size of each 'grid') at every turn
  • If Pac-Man hits a wall, he will stop
  • If Pac-Man hits a ghost, check for game over

ghostMovement ()

  • Ghost will move in a default direction
  • If ghost hits a wall, he will move in a new random direction (ghostHitWallNewDir function) (randomGhostDirection function)

checkScore ()

  • Keep track of the score based on the number of dots eaten by Pac-Man
  • If all the dots have been eaten, check for game over

gameOver ()

  • Display screen depends on the result (win, lose, lives > 1)

nextLevel ()

  • The speed of Pac-Man and ghosts will increase by 1

startGame ()

  • Start new game
  • Reset all variables

To Be Implemented/ To Be Resolved

  • Ghost AI
  • Audio on Mobile
  • Better User Interface for Device in Landscape Mode

Built With

  • HTML5
  • CSS3
  • Javascript
  • jQuery Mobile

Acknowledgements

project-1's People

Contributors

shumin13 avatar primaulia avatar taykangsheng 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.