Pacman logo Pacman Game






Documentation

Initial Plugin

Call jQuery and create the object jPacman

$('#tablero').jPacman({
foo : 'bar',
bar : 'foo'
});
Name Type Default Description
map Array Array[] Pacman map, is used to draw the game
Height Int 16 Height of each of the "tabs" that make up the board
Width Int 16 Width of each of the "tabs" that make up the board
initialX Int 14 Point x axis
initialY Int 23 Point Y axis, this value and initialX, pacman places in the game board
time Int 250 movement speed
score Int 0 Score initial of game
lives Int 3 Numbre of lives

Example Scenario

  1. X = wall
  2. '.' = road
  3. You can change default map, when you create the game
map =[
['X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X'], ['X','.','.','.','.','.','.','.','.','.','.','.','.','X','X','.','.','.','.','.','.','.','.','.','.','.','.','X'], ['X','.','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','.','X'], ['X','.','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','.','X'], ['X','.','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','.','X'], ['X','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','X'], ['X','.','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','.','X'], ['X','.','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','.','X'], ['X','.','.','.','.','.','.','X','X','.','.','.','.','X','X','.','.','.','.','X','X','.','.','.','.','.','.','X'], ['X','X','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','.','.','.','.','.','.','.','.','.','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','X','X','X','-','-','X','X','X','.','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','X','h','h','h','h','h','h','X','.','X','X','.','X','X','X','X','X','X'], ['.','.','.','.','.','.','.','.','.','.','X','h','h','h','h','h','h','X','.','.','.','.','.','.','.','.','.','.'], ['X','X','X','X','X','X','.','X','X','.','X','h','h','h','h','h','h','X','.','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','.','.','.','.','.','.','.','.','.','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X'], ['X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X'], ['X','.','.','.','.','.','.','.','.','.','.','.','.','X','X','.','.','.','.','.','.','.','.','.','.','.','.','X'], ['X','.','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','.','X'], ['X','.','X','X','X','X','.','X','X','X','X','X','.','X','X','.','X','X','X','X','X','.','X','X','X','X','.','X'], ['X','.','.','.','X','X','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','X','X','.','.','.','X'], ['X','X','X','.','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','.','X','X','X'], ['X','X','X','.','X','X','.','X','X','.','X','X','X','X','X','X','X','X','.','X','X','.','X','X','.','X','X','X'], ['X','.','.','.','.','.','.','X','X','.','.','.','.','X','X','.','.','.','.','X','X','.','.','.','.','.','.','X'], ['X','.','X','X','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','X','X','.','X'], ['X','.','X','X','X','X','X','X','X','X','X','X','.','X','X','.','X','X','X','X','X','X','X','X','X','X','.','X'], ['X','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','X'], ['X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X'], ]

Private Arguments

var pacman; //Yellow Pacman
var blinky; //Red Ghost
var pinky; //Pink Ghost
var inky; //Cyan Ghost
var clyde; //Orange Ghost
var stepping = []; //Array where i store the steps to resolve the maze
var step=0;//index of Array

Private Methods

game:function(status)// Principal function of game, receives the status of game {"play","stop","paused"}
draw: function()// Draw board
move: function(x,y) //Bolean function, say if you can move the dummie
listen:function()//read keystrokes
autoMove:function()//like move but automatic
hunt:function() // go to looking pacman and try to hunt
isTake:function()//Stop the game if pacman ghost hunt
resolve:function(x,y,lab)// function used to get the path to pacman

Changelog Current Version

Version: 1.2
Author: Mario Vasile Cabezas
Date: 31/10/2012 # fotmat(dd/mm/year) #
Twitter: @MarioSkill

  What is Work now ?

  1. The game ends when you hunt 3 times to pacman
  2. added points count
  3. added lives count
  4. Fix issue from previous version
  5. Update docs,now is responsive

  known issues

  1. Sometimes the game does not end when pacman is hunted by the ghost

  What is Work, Version 1.0

  1. Draw the board
  2. Move pacman for all board
  3. "Resolve" the maze, find the pacman and try to hunt

  known issues Version 1.0

  1. Infinity loop, when you press play buttom

This proyect is development and is not finish