From c69b4c4692e737fae0d766743c309ba4a13fd6b6 Mon Sep 17 00:00:00 2001 From: teuno Date: Wed, 29 Mar 2017 13:14:55 +0200 Subject: [PATCH] Spullen gemaakt door Teuno Speler positie verplaatst maar voor speler1 --- pacman/Images/sprites.png | Bin 0 -> 22520 bytes pacman/enums.js | 411 ++++++++++++++++++++++++++++++++++++++ pacman/index.html | 226 ++++++++++++++------- pacman/server.js | 14 +- 4 files changed, 576 insertions(+), 75 deletions(-) create mode 100644 pacman/Images/sprites.png create mode 100644 pacman/enums.js diff --git a/pacman/Images/sprites.png b/pacman/Images/sprites.png new file mode 100644 index 0000000000000000000000000000000000000000..abcd9f1c6767d5389a11f0279574486e4ca4cf4b GIT binary patch literal 22520 zcmeI4c{tQ<^zgq#S(2qtk!7Tkeak-fC}iKWj4_rlGnuikp%R5cvdfZW&%R4ZSwr?U zYhtV!+22t;Pd)SW`2F7ZdjB*RX3l-?bIyH#&biNg$8~+@p2jsL3bNB=002;2QC85x zJ&ytafj-G$+^dR6xhJ?MQlzpW3INED@BI=0F>xmWfK1I+US31P27yMPY!FD6EAsLz zNJoT~tvw6?T>Im-T@1q4=)fauFiJhS-o^YV`&$5rEsNwGm0>c~BLEUWMI%#xJCIE8 z1TA%(vhEwdE;8l#z_FwYrPi`Rfkwf)*G1=<2h)qZ+!rvI&7RH5>A2~wR<|}vUuv3j z52uoE0AgCVCB=K0L)Devysz>lq*WdzVxgL9sY4K1dJrCNpM`01pU&=nG0`31un(bKP57T!giCKvI?rh=-^)hrrjcSU`!;w~82W z4lxL$lraZr* zx+TMu@KocSDI+O*&|0^oye*^7We8*Wi34+P4} zo_s8ON~c!5m#8T3(CH-Vm`_xNulPkNrblV6-R&29$c5%2pf3EA`r9{ zRH?)taqFe#p^t=4GG))1PY1nCLbaoXC{27HC)>53E@YDOEly5vSNZIO2E2kopuX+= z$E@!6L9XAwt7v}D;Pkl$I_RWYEMc(k@i`LH0IE8BzpyYR z162e0=j?NAg*4?P`lS8={B`F+;m_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Nd?uf z<%tk~hLa9qy$Rk1nPV!ew6G)}j1#TAsspyJy45(2U-{w@BvBdX)fV2a64=a;7Qu8! z793CtuZ4xW$gUNRTsI$&CDCfky7?)P>8);nSZLp-r%bfqAa7sO_fU$4`6OTUlA(1in6>JkgUS zFt}Pg%v}HoLH8S>dXGIKawoU{)Vdi>aUXNfJ9SJ4!oB*4B-tgl*Ec9`? zek+k6kc1wUJrE5IvsF{MnF_Z5Y*3XObO#_O>t)ZQA-qQI*f?;_*aRy~__eS1vMh=m z*|JMLDr-Cv@rpUBx2M>$xB>8(c;)%AGs^p(2*i`Hx$2D+VSp9lGJmf4V^?~#`i?Y^ Z@%e*!R=h(S?q7Sr6~$``IdbNH{|DiY-}wLl literal 0 HcmV?d00001 diff --git a/pacman/enums.js b/pacman/enums.js new file mode 100644 index 0000000..51a3e6f --- /dev/null +++ b/pacman/enums.js @@ -0,0 +1,411 @@ +const Gamestate = { + START: 0, + DEAD: 1, + PLAYING: 2, + WIN: 3 +} + + +const Direction = { + RIGHT: 0, + DOWN: 1, + LEFT: 2, + UP: 3 +} + + +ghostCords["blinky"] = ('120,109,0,0,0'); +ghostCords["pinky"] = ('89,130,1,0,600'); +ghostCords["inky"] = ('105,130,1,0,300'); +ghostCords["clyde"] = ('121,130,1,0,900'); + + +//sprites +const sprites = new Image(); +sprites.src = "Images/sprites.png"; +//sounds +const waka = new Audio("Sounds/waka.ogg"); +const opening = new Audio("Sounds/opening.ogg"); +const dead = new Audio("Sounds/dead.ogg"); + + +function createBalls() { + let balls = []; + //lane 1 + balls.push('12,36'); + balls.push('20,36'); + balls.push('28,36'); + balls.push('36,36'); + balls.push('44,36'); + balls.push('52,36'); + balls.push('60,36'); + balls.push('68,36'); + balls.push('76,36'); + balls.push('84,36'); + balls.push('92,36'); + balls.push('100,36'); + balls.push('124,36'); + balls.push('132,36'); + balls.push('140,36'); + balls.push('148,36'); + balls.push('156,36'); + balls.push('164,36'); + balls.push('172,36'); + balls.push('180,36'); + balls.push('188,36'); + balls.push('196,36'); + balls.push('204,36'); + balls.push('212,36'); + // lane 2 + balls.push('12,44'); + balls.push('52,44'); + balls.push('100,44'); + balls.push('124,44'); + balls.push('172,44'); + balls.push('212,44'); + //lane 3 + balls.push('12,52');// groot + balls.push('52,52'); + balls.push('100,52'); + balls.push('124,52'); + balls.push('172,52'); + balls.push('212,52');// groot + //lane 4 + balls.push('12,60'); + balls.push('52,60'); + balls.push('100,60'); + balls.push('124,60'); + balls.push('172,60'); + balls.push('212,60'); + //lane 5 + balls.push('12,68'); + balls.push('20,68'); + balls.push('28,68'); + balls.push('36,68'); + balls.push('44,68'); + balls.push('52,68'); + balls.push('60,68'); + balls.push('68,68'); + balls.push('76,68'); + balls.push('84,68'); + balls.push('92,68'); + balls.push('100,68'); + balls.push('108,68'); + balls.push('116,68'); + balls.push('124,68'); + balls.push('132,68'); + balls.push('140,68'); + balls.push('148,68'); + balls.push('156,68'); + balls.push('164,68'); + balls.push('172,68'); + balls.push('180,68'); + balls.push('188,68'); + balls.push('196,68'); + balls.push('204,68'); + balls.push('212,68'); + //lane 6 + balls.push('12,76'); + balls.push('52,76'); + balls.push('76,76'); + balls.push('148,76'); + balls.push('172,76'); + balls.push('212,76'); + //lane 7 + balls.push('12,84'); + balls.push('52,84'); + balls.push('76,84'); + balls.push('148,84'); + balls.push('172,84'); + balls.push('212,84'); + //lane 8 + balls.push('12,92'); + balls.push('20,92'); + balls.push('28,92'); + balls.push('36,92'); + balls.push('44,92'); + balls.push('52,92'); + balls.push('76,92'); + balls.push('84,92'); + balls.push('92,92'); + balls.push('100,92'); + balls.push('124,92'); + balls.push('132,92'); + balls.push('140,92'); + balls.push('148,92'); + balls.push('172,92'); + balls.push('180,92'); + balls.push('188,92'); + balls.push('196,92'); + balls.push('204,92'); + balls.push('212,92'); + //lane 9 + balls.push('52,100'); + balls.push('172,100'); + //lane 10 + balls.push('52,108'); + balls.push('172,108'); + //lane 11 + balls.push('52,116'); + balls.push('172,116'); + //lane 12 + balls.push('52,124'); + balls.push('172,124'); + //lane 13 + balls.push('52,132'); + balls.push('172,132'); + //lane 14 + balls.push('52,140'); + balls.push('172,140'); + //lane 15 + balls.push('52,148'); + balls.push('172,148'); + //lane 16 + balls.push('52,156'); + balls.push('172,156'); + //lane 17 + balls.push('52,164'); + balls.push('172,164'); + //lane 18 + balls.push('52,172'); + balls.push('172,172'); + //lane 19 + balls.push('52,180'); + balls.push('172,180'); + //lane 20 + balls.push('12,188'); + balls.push('20,188'); + balls.push('28,188'); + balls.push('36,188'); + balls.push('44,188'); + balls.push('52,188'); + balls.push('60,188'); + balls.push('68,188'); + balls.push('76,188'); + balls.push('84,188'); + balls.push('92,188'); + balls.push('100,188'); + balls.push('124,188'); + balls.push('132,188'); + balls.push('140,188'); + balls.push('148,188'); + balls.push('156,188'); + balls.push('164,188'); + balls.push('172,188'); + balls.push('180,188'); + balls.push('188,188'); + balls.push('196,188'); + balls.push('204,188'); + balls.push('212,188'); + // lane 21 + balls.push('12,196'); + balls.push('52,196'); + balls.push('100,196'); + balls.push('124,196'); + balls.push('172,196'); + balls.push('212,196'); + // lane 22 + balls.push('12,204'); + balls.push('52,204'); + balls.push('100,204'); + balls.push('124,204'); + balls.push('172,204'); + balls.push('212,204'); + //lane 23 + balls.push('12,212');// groot + balls.push('20,212'); + balls.push('28,212'); + balls.push('52,212'); + balls.push('60,212'); + balls.push('68,212'); + balls.push('76,212'); + balls.push('84,212'); + balls.push('92,212'); + balls.push('100,212'); + balls.push('124,212'); + balls.push('132,212'); + balls.push('140,212'); + balls.push('148,212'); + balls.push('156,212'); + balls.push('164,212'); + balls.push('172,212'); + balls.push('196,212'); + balls.push('204,212'); + balls.push('212,212');// groot + // lane 24 + balls.push('28,220'); + balls.push('52,220'); + balls.push('76,220'); + balls.push('148,220'); + balls.push('172,220'); + balls.push('196,220'); + // lane 25 + balls.push('28,228'); + balls.push('52,228'); + balls.push('76,228'); + balls.push('148,228'); + balls.push('172,228'); + balls.push('196,228'); + //lane 26 + balls.push('12,236'); + balls.push('20,236'); + balls.push('28,236'); + balls.push('36,236'); + balls.push('44,236'); + balls.push('52,236'); + balls.push('76,236'); + balls.push('84,236'); + balls.push('92,236'); + balls.push('100,236'); + balls.push('124,236'); + balls.push('132,236'); + balls.push('140,236'); + balls.push('148,236'); + balls.push('172,236'); + balls.push('180,236'); + balls.push('188,236'); + balls.push('196,236'); + balls.push('204,236'); + balls.push('212,236'); + // lane 27 + balls.push('12,244'); + balls.push('100,244'); + balls.push('124,244'); + balls.push('212,244'); + // lane 28 + balls.push('12,252'); + balls.push('100,252'); + balls.push('124,252'); + balls.push('212,252'); + //lane 29 + balls.push('12,260'); + balls.push('20,260'); + balls.push('28,260'); + balls.push('36,260'); + balls.push('44,260'); + balls.push('52,260'); + balls.push('60,260'); + balls.push('68,260'); + balls.push('76,260'); + balls.push('84,260'); + balls.push('92,260'); + balls.push('100,260'); + balls.push('108,260'); + balls.push('116,260'); + balls.push('124,260'); + balls.push('132,260'); + balls.push('140,260'); + balls.push('148,260'); + balls.push('156,260'); + balls.push('164,260'); + balls.push('172,260'); + balls.push('180,260'); + balls.push('188,260'); + balls.push('196,260'); + balls.push('204,260'); + balls.push('212,260'); + return balls; +} + + +function createGmap() { + var gmap = []; + //lane 1 + gmap.push('5,29,8') + gmap.push('45,29,4') + gmap.push('93,29,7') + gmap.push('117,29,8') + gmap.push('165,29,4') + gmap.push('205,29,7') + + //lane 2 + + gmap.push('5,61,1') + gmap.push('45,61,0') + gmap.push('69,61,4') + gmap.push('93,61,2') + gmap.push('117,61,2') + gmap.push('141,61,4') + gmap.push('165,61,0') + gmap.push('205,61,3') + + //lane 3 + gmap.push('5,85,5') + gmap.push('45,85,3') + gmap.push('69,85,5') + gmap.push('93,85,7') + gmap.push('117,85,8') + gmap.push('141,85,6') + gmap.push('165,85,1') + gmap.push('205,85,6') + + //lane 4 + gmap.push('69,109,8') + gmap.push('93,109,2') + gmap.push('117,109,2') + gmap.push('141,109,7') + + //lane 5 teleport ding implanteren hiero_____________________________ + gmap.push('-16,133,9') + gmap.push('45,133,0') + gmap.push('69,133,3') + gmap.push('141,133,1') + gmap.push('165,133,0') + gmap.push('240,133,10') + + + //lane 6 + gmap.push('69,157,1') + gmap.push('141,157,3') + + //lane 7 + gmap.push('5,181,8') + gmap.push('45,181,0') + gmap.push('69,181,2') + gmap.push('93,181,7') + gmap.push('117,181,8') + gmap.push('141,181,2') + gmap.push('165,181,0') + gmap.push('205,181,7') + + //lane 8 1==| 2==_ 3== | 4== - 5==|_ 6==_| 7==-| 8==|- + gmap.push('5,205,5') + gmap.push('21,205,7') + gmap.push('69,205,4') + gmap.push('45,205,1') + gmap.push('93,205,2') + gmap.push('117,205,2') + gmap.push('165,205,3') + gmap.push('141,205,4') + gmap.push('189,205,8') + gmap.push('205,205,6') + + //lane 9 + gmap.push('5,229,8') + gmap.push('21,229,2') + gmap.push('45,229,6') + gmap.push('69,229,5') + gmap.push('93,229,7') + gmap.push('117,229,8') + gmap.push('141,229,6') + gmap.push('165,229,5') + gmap.push('189,229,2') + gmap.push('205,229,7') + + //lane 10 + gmap.push('5,253,5') + gmap.push('93,253,2') + gmap.push('117,253,2') + gmap.push('205,253,6') + + //kooi + gmap.push('89,128,8') + gmap.push('89,138,5') + gmap.push('105,128,0') + gmap.push('105,138,2') + gmap.push('121,128,7') + gmap.push('121,138,6') + gmap.push('105,109,11') + + return gmap; +} diff --git a/pacman/index.html b/pacman/index.html index 178f5ba..25286ed 100644 --- a/pacman/index.html +++ b/pacman/index.html @@ -1,73 +1,153 @@ - - - - - - Please get a browser with proper HTML5 support - - - + + + + + + Please get a browser with proper HTML5 support + + + diff --git a/pacman/server.js b/pacman/server.js index 6acb6cf..c3ba121 100644 --- a/pacman/server.js +++ b/pacman/server.js @@ -23,10 +23,20 @@ const io = require('socket.io').listen(server) // Handles the websocket client connect. io.sockets.on("connection", socket => { - console.log("User connected: " + socket.id) - socket.on("ClientMessage", (key, agent) => handleInput(key, agent)) + console.log("User connected: " + socket.id) + socket.on("ClientMessage", (key, agent) => handleInput(key, agent)) + + socket.on("updatePlayerLocation", updatePlayerLocation) + + function updatePlayerLocation(data) { + console.log(data) + socket.broadcast.emit("updatePlayerLocation", data) + } + }) + + const handleInput = (key, agent) => { console.log(key) io.emit('UpdatePlayer',{key, agent})