daleharvey / pacman

HTML5 Pacman
Do What The F*ck You Want To Public License
705 stars 472 forks source link

object clone corrupts JQuery #16

Open surfskidude opened 7 years ago

surfskidude commented 7 years ago

The clone function at the end of pacman.js seems to corrupt JQuery, in particular the $.getXXX functions.

I removed the code and replaced: map = Pacman.MAP.clone(); with map = Pacman.MAP;

The code seems to work with this change

vmeijering commented 5 years ago

It does work at first. Until you complete level 1. The biscuits dont reset because you don't clone the map anymore but use the current instance of the map

popoulos commented 3 years ago

just replace map = Pacman.MAP.clone(); with map = JSON.parse(JSON.stringify(Pacman.MAP)); and remove the Object.prototype.clone function

devtechk commented 2 years ago

Hello, it solves a lot of problem also if you want to import it in angular component. Thank you!