Skip to content

shumin13/project-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 88.1%
  • CSS 7.1%
  • HTML 4.8%