From 6c24d8358628e631a352af434e8bacf1a26f608c Mon Sep 17 00:00:00 2001 From: "Glitch (long-scarce-leo)" Date: Thu, 29 Jul 2021 03:34:44 +0000 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=8C=B2=F0=9F=8D=B3=20Updated=20with?= =?UTF-8?q?=20Glitch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .glitch-assets | 20 +++++ README.md | 25 ++++++ game | 1 - index.html | 25 ++++++ script.js | 234 +++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 11 +++ 6 files changed, 315 insertions(+), 1 deletion(-) create mode 100644 .glitch-assets create mode 100644 README.md delete mode 100644 game create mode 100644 index.html create mode 100644 script.js create mode 100644 style.css diff --git a/.glitch-assets b/.glitch-assets new file mode 100644 index 0000000..c181370 --- /dev/null +++ b/.glitch-assets @@ -0,0 +1,20 @@ +{"name":"drag-in-files.svg","date":"2016-10-22T16:17:49.954Z","url":"https://cdn.hyperdev.com/drag-in-files.svg","type":"image/svg","size":7646,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/drag-in-files.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(102, 153, 205)","uuid":"adSBq97hhhpFNUna"} +{"name":"click-me.svg","date":"2016-10-23T16:17:49.954Z","url":"https://cdn.hyperdev.com/click-me.svg","type":"image/svg","size":7116,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/click-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(243, 185, 186)","uuid":"adSBq97hhhpFNUnb"} +{"name":"paste-me.svg","date":"2016-10-24T16:17:49.954Z","url":"https://cdn.hyperdev.com/paste-me.svg","type":"image/svg","size":7242,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/paste-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(42, 179, 185)","uuid":"adSBq97hhhpFNUnc"} +{"uuid":"adSBq97hhhpFNUna","deleted":true} +{"uuid":"adSBq97hhhpFNUnb","deleted":true} +{"uuid":"adSBq97hhhpFNUnc","deleted":true} +{"name":"pacman-right.png","date":"2021-07-16T19:47:19.930Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-right.png","type":"image/png","size":15632,"imageWidth":242,"imageHeight":265,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-right.png","thumbnailWidth":242,"thumbnailHeight":265,"uuid":"tPaoeNQlBxyq1f96"} +{"name":"pacman-up.png","date":"2021-07-16T19:47:20.140Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-up.png","type":"image/png","size":16570,"imageWidth":265,"imageHeight":242,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-up.png","thumbnailWidth":265,"thumbnailHeight":242,"uuid":"GlUQt7Wvof4cskIT"} +{"name":"pacman-left.png","date":"2021-07-16T19:47:21.802Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-left.png","type":"image/png","size":16531,"imageWidth":242,"imageHeight":265,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-left.png","thumbnailWidth":242,"thumbnailHeight":265,"uuid":"XRoPL6IaAuyqivQX"} +{"name":"pacman-down.png","date":"2021-07-16T19:47:23.374Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-down.png","type":"image/png","size":16560,"imageWidth":265,"imageHeight":242,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-down.png","thumbnailWidth":265,"thumbnailHeight":242,"uuid":"Rzf2M940OupH3Qzf"} +{"name":"panda one.jpeg","date":"2021-07-16T22:10:20.728Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpanda%20one.jpeg","type":"image/jpeg","size":53162,"imageWidth":640,"imageHeight":480,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2Fpanda%20one.jpeg","thumbnailWidth":330,"thumbnailHeight":248,"uuid":"iA8kidBJN9bAiZax"} +{"name":"kisspng-pac-man-world-3-ghosts-clip-art-pac-man-ghost-png-transparent-image-5a7561ae2a7482.6496024615176421581739.jpg","date":"2021-07-16T22:16:27.527Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fkisspng-pac-man-world-3-ghosts-clip-art-pac-man-ghost-png-transparent-image-5a7561ae2a7482.6496024615176421581739.jpg","type":"image/jpeg","size":45509,"imageWidth":900,"imageHeight":900,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2Fkisspng-pac-man-world-3-ghosts-clip-art-pac-man-ghost-png-transparent-image-5a7561ae2a7482.6496024615176421581739.jpg","thumbnailWidth":330,"thumbnailHeight":330,"uuid":"yxMpVTj9YBo4BpUQ"} +{"name":"kisspng-pac-man-left.png","date":"2021-07-16T22:21:06.077Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fkisspng-pac-man-left.png","type":"image/png","size":11137,"imageWidth":900,"imageHeight":900,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2Fkisspng-pac-man-left.png","thumbnailWidth":330,"thumbnailHeight":330,"uuid":"k5xG67KBD5lrXqNY"} +{"name":"kisspng-pac-man-games-ghosts-blue-ghost-cliparts-5a8481acad2b23.0337823915186333887093.jpg","date":"2021-07-16T22:29:57.394Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fkisspng-pac-man-games-ghosts-blue-ghost-cliparts-5a8481acad2b23.0337823915186333887093.jpg","type":"image/jpeg","size":32916,"imageWidth":900,"imageHeight":600,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2Fkisspng-pac-man-games-ghosts-blue-ghost-cliparts-5a8481acad2b23.0337823915186333887093.jpg","thumbnailWidth":330,"thumbnailHeight":220,"uuid":"PWTiCmFAky4WvsUG"} +{"name":"kisspng-pac-man-left2.png","date":"2021-07-16T22:31:33.359Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fkisspng-pac-man-left2.png","type":"image/png","size":14073,"imageWidth":900,"imageHeight":600,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2Fkisspng-pac-man-left2.png","thumbnailWidth":330,"thumbnailHeight":220,"uuid":"ZUuoFhTB9dWGmwsY"} +{"name":"Pinky.png","date":"2021-07-16T22:36:08.358Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky.png","type":"image/png","size":77886,"imageWidth":960,"imageHeight":720,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2FPinky.png","thumbnailWidth":330,"thumbnailHeight":248,"uuid":"0ALpzvTprJ4pheyE"} +{"name":"Pinky (1).png","date":"2021-07-16T22:37:18.102Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(1).png","type":"image/png","size":181378,"imageWidth":960,"imageHeight":720,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2FPinky%20(1).png","thumbnailWidth":330,"thumbnailHeight":248,"uuid":"j9NlyDyguvRtAWnU"} +{"name":"Pinky (2).png","date":"2021-07-16T22:38:31.582Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(2).png","type":"image/png","size":42444,"imageWidth":960,"imageHeight":720,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2FPinky%20(2).png","thumbnailWidth":330,"thumbnailHeight":248,"uuid":"EkmDeHR1RidmRfLF"} +{"name":"Blinky.png","date":"2021-07-16T22:40:15.111Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky.png","type":"image/png","size":226876,"imageWidth":960,"imageHeight":720,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2FBlinky.png","thumbnailWidth":330,"thumbnailHeight":248,"uuid":"L8pmzaN9rlaRESkD"} +{"name":"Blinky (1) .png","date":"2021-07-16T22:41:30.188Z","url":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky%20(1)%20.png","type":"image/png","size":47236,"imageWidth":960,"imageHeight":720,"thumbnail":"https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fthumbnails%2FBlinky%20(1)%20.png","thumbnailWidth":330,"thumbnailHeight":248,"uuid":"LDtggroK93JeY8Ye"} diff --git a/README.md b/README.md new file mode 100644 index 0000000..9543926 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +CSSI Day 1 - Olympic Rings +================= + +Your Project +------------ + +### ← README.md + +That's this file, where you can tell people what your cool website does and how you built it. + +### ← index.html + +Where you'll write the content of your website. + +### ← style.css + +CSS files add styling rules to your content. + +### ← script.js + +If you're feeling fancy you can add interactivity to your site with JavaScript. + +### ← assets + +Drag in `assets`, like images or music, to add them to your project \ No newline at end of file diff --git a/game b/game deleted file mode 100644 index 8b13789..0000000 --- a/game +++ /dev/null @@ -1 +0,0 @@ - diff --git a/index.html b/index.html new file mode 100644 index 0000000..ab1cdd2 --- /dev/null +++ b/index.html @@ -0,0 +1,25 @@ + + + + + + + + + CSSI Day 1 + + + + + + + + + + + + + + + + diff --git a/script.js b/script.js new file mode 100644 index 0000000..3aec3b1 --- /dev/null +++ b/script.js @@ -0,0 +1,234 @@ +// Name any p5.js functions we use in `global` so Glitch can recognize them. +/* global + * background, createCanvas, ellipse, noFill, stroke, strokeWeight, rect, image, loadImage, fill, colorMode, HSB, y, keyCode, pManCurrX, circle, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, pinkGhostRight + */ + +// Content behind double slashes is a comment. Use it for plain English notes, +// or for code that you want to temporarily disable. + +let startingX; +let startingY; + +let speedX; +let speedY; + +let pManCurrPosX; +let pManCurrPosY; + +//2d array for the map. 0 = wall, 1 = open space, +let world = [ + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0], + + [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0], + + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0], + + [0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0], + + [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0], + + [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0], + + [0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0], + + [0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], + + [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], +]; + +let cellSize = 50; + + +//pacman images +let pacmanAvatar; +let pacManUp; +let pacManDown; +let pacManRight; +let pacManLeft; + +let panda; + +let wallColor ; + +let score; + +const DIRECTIONS = { + LEFT: "left", + RIGHT: "right", + UP: "up", + DOWN: "down", + IDLE: "idle", +} + +let direction = DIRECTIONS.IDLE; + +function setup() +{ + createCanvas(1050, 550); + colorMode(HSB, 360, 100, 100); + // We only want to load the logo once. + pManCurrPosX = 150; + pManCurrPosY = 150; + pinkGhostPosX = 450; + pinkGhostPosY = 250; + blueGhostPosX = 500; + blueGhostPosY = 250; + startingX = 50; + startingY = 50; + speedX = 10; + speedY = 10; + + wallColor = color(235, 100, 100); + pacManRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-right.png?v=1626464839930"); + pacManUp = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-up.png?v=1626464840140"); + pacManDown = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-down.png?v=1626464843374"); + pacManLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-left.png?v=1626464841802"); + pinkGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(1).png?v=1626475038102"); + pinkGhostLeft = loadImage("hhttps://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(2).png?v=1626475111582"); + blueGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky.png?v=1626475215111"); + blueGhostLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky%20(1)%20.png?v=1626475290188"); + //wanna go on a jcall? + // yeah that'll work better than this lol + //https://meet.google.com/mzj-nddr-njk?authuser=0 + //join the link above manroop are you still here? + pacmanAvatar = pacManRight; + score = 0; +} + +function draw(){ // continuously draws the maze + background(0); + image(pacmanAvatar, pManCurrPosX, pManCurrPosY, 50, 50); + image(pinkGhostRight, pinkGhostPosX, pinkGhostPosY, 50, 50); + image(blueGhostLeft, blueGhostPosX, blueGhostPosY, 50, 50); + drawMap(); + fill(255,100,100) + rect(675,0,100,100) + drawScore(); + +} + +function drawMap(){ + for(let i = 0; i < world.length; i++) { + for (let j = 0; j < world[0].length; j++) { + if (world[i][j] == 0) { + // draws a wall + fill(wallColor); + strokeWeight(1); + rect(50*j, 50*i, 50, 50); + } else if (world[i][j] == 1){ // position of coins + fill(63, 100, 100); + ellipse((j * 50) + 25, (i * 50) + 25, 10); + } else if (world[i][j] == 2) { + fill(0); + ellipse((j * 50) + 25, (i * 50) + 25, 10); + } + } + } +} + +function drawScore() { + if(score < 10){ + fill(100) + .strokeWeight(0) + .textSize(80); + } else if( score < 100){ + fill(100) + .strokeWeight(0) + .textSize(50); + } else { + fill(100) + .strokeWeight(0) + .textSize(40); + } + + text(score, 700, 80); +} + +// function ghosts() { + +// } +/** +* [UNTESTED FUNCTION] +* Moves the pacman using a switch statment called direction with 5 modes: idle, left, up, down, right. +* If the cell directly ahead of the pacman is a wall then it moves the state to idle +**/ +function movePacman(){ + var addX; + var addY; + var maxVelocity = 25; + if ((direction === DIRECTIONS.LEFT && (world[(pManCurrPosY)/50][((pManCurrPosX -50) /50)] === 0)) + || (direction === DIRECTIONS.RIGHT && (world[(pManCurrPosY)/50][((pManCurrPosX + 50) /50)] === 0)) + || (direction === DIRECTIONS.UP && (world[(pManCurrPosY - 50)/50][(pManCurrPosX/50)] === 0)) + || (direction === DIRECTIONS.DOWN && (world[(pManCurrPosY + 50)/50][(pManCurrPosX/50)] === 0))) { + direction = DIRECTIONS.IDLE + } + switch (direction) { + case DIRECTIONS.IDLE: + addX = 0; + addY = 0; + break; + case DIRECTIONS.LEFT : + addX = -(maxVelocity); + addY = 0; + break; + case DIRECTIONS.RIGHT: + addX = (maxVelocity); + addY = 0; + break; + case DIRECTIONS.UP: + addX = 0; + addY = -(maxVelocity); + break; + case DIRECTIONS.DOWN: + addX = 0; + addY = (maxVelocity); + break; + default: + addX = 0; + addY = 0; + break; + + } + pManCurrPosX += (addX); + pManCurrPosY += (addY); +} + + +function keyPressed() +{ + + if(keyCode === DOWN_ARROW){ + if(!(world[(pManCurrPosY + 50)/50][(pManCurrPosX/50)] === 0)){ + pacmanAvatar = pacManDown; + pManCurrPosY += 50; + direction = DIRECTIONS.DOWN; + } + } else if(keyCode === UP_ARROW){ + if(!(world[(pManCurrPosY - 50)/50][(pManCurrPosX/50)] === 0)){ + pacmanAvatar = pacManUp; + pManCurrPosY -= 50; + direction = DIRECTIONS.UP; + } + } else if(keyCode === RIGHT_ARROW){ + if(!(world[(pManCurrPosY)/50][((pManCurrPosX + 50) /50)] === 0)){ + pacmanAvatar = pacManRight; + pManCurrPosX += 50; + direction = DIRECTIONS.RIGHT; + } + } else if (keyCode === LEFT_ARROW){ + if(!(world[(pManCurrPosY)/50][((pManCurrPosX -50) /50)] === 0)){ + pacmanAvatar = pacManLeft; + pManCurrPosX -= 50; + direction = DIRECTIONS.LEFT; + } + } + if(world[(pManCurrPosY) / 50][(pManCurrPosX / 50)] === 1){ + world[(pManCurrPosY) / 50][(pManCurrPosX / 50)] = 2; + score++; + } + +} \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..f013185 --- /dev/null +++ b/style.css @@ -0,0 +1,11 @@ +/* CSS files add styling rules to your content */ + +body { + font-family: helvetica, arial, sans-serif; + margin: 2em; +} + +h1 { + font-style: italic; + color: #373fff; +} From cc69c2cc244e5931123704795f3760617c58da6b Mon Sep 17 00:00:00 2001 From: shhhushhh <57884384+shhhushhh@users.noreply.github.com> Date: Wed, 28 Jul 2021 20:45:18 -0700 Subject: [PATCH 2/7] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9543926..03c14c8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -CSSI Day 1 - Olympic Rings +CSSI Extension Friday Project: Pacman ================= Your Project @@ -6,20 +6,20 @@ Your Project ### ← README.md -That's this file, where you can tell people what your cool website does and how you built it. +Not much to say other than it's a scuffed version of Pacman :D I mainly worked on creating the world array, the drawMap() function, and implementing the coins. ### ← index.html -Where you'll write the content of your website. +Focused mainly on exploring the p5 library in Javascript so not much emphasis was placed on html or css ### ← style.css -CSS files add styling rules to your content. +See html ### ← script.js -If you're feeling fancy you can add interactivity to your site with JavaScript. +Utilized the p5 library in Javascript to create our version of Pacman! This was a timed project and we completed it in around 3 hours. ### ← assets -Drag in `assets`, like images or music, to add them to your project \ No newline at end of file +There are several assets (including the ghosts which have not been implemented yet) included. From dabd85a0c039a7a7b32ea92a88b812c5a9155676 Mon Sep 17 00:00:00 2001 From: shhhushhh <57884384+shhhushhh@users.noreply.github.com> Date: Wed, 28 Jul 2021 20:48:31 -0700 Subject: [PATCH 3/7] Update script.js --- script.js | 68 +++++-------------------------------------------------- 1 file changed, 6 insertions(+), 62 deletions(-) diff --git a/script.js b/script.js index 3aec3b1..c6d0d35 100644 --- a/script.js +++ b/script.js @@ -3,9 +3,6 @@ * background, createCanvas, ellipse, noFill, stroke, strokeWeight, rect, image, loadImage, fill, colorMode, HSB, y, keyCode, pManCurrX, circle, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, pinkGhostRight */ -// Content behind double slashes is a comment. Use it for plain English notes, -// or for code that you want to temporarily disable. - let startingX; let startingY; @@ -83,7 +80,7 @@ function setup() speedY = 10; wallColor = color(235, 100, 100); - pacManRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-right.png?v=1626464839930"); + pacManRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-right.png?v=1626464839930"); // loads in Pacman/ghosts facing different directions pacManUp = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-up.png?v=1626464840140"); pacManDown = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-down.png?v=1626464843374"); pacManLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-left.png?v=1626464841802"); @@ -91,10 +88,7 @@ function setup() pinkGhostLeft = loadImage("hhttps://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(2).png?v=1626475111582"); blueGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky.png?v=1626475215111"); blueGhostLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky%20(1)%20.png?v=1626475290188"); - //wanna go on a jcall? - // yeah that'll work better than this lol - //https://meet.google.com/mzj-nddr-njk?authuser=0 - //join the link above manroop are you still here? + pacmanAvatar = pacManRight; score = 0; } @@ -111,7 +105,7 @@ function draw(){ // continuously draws the maze } -function drawMap(){ +function drawMap(){ // creates the maze for(let i = 0; i < world.length; i++) { for (let j = 0; j < world[0].length; j++) { if (world[i][j] == 0) { @@ -130,7 +124,7 @@ function drawMap(){ } } -function drawScore() { +function drawScore() { // displays the score if(score < 10){ fill(100) .strokeWeight(0) @@ -148,57 +142,7 @@ function drawScore() { text(score, 700, 80); } -// function ghosts() { - -// } -/** -* [UNTESTED FUNCTION] -* Moves the pacman using a switch statment called direction with 5 modes: idle, left, up, down, right. -* If the cell directly ahead of the pacman is a wall then it moves the state to idle -**/ -function movePacman(){ - var addX; - var addY; - var maxVelocity = 25; - if ((direction === DIRECTIONS.LEFT && (world[(pManCurrPosY)/50][((pManCurrPosX -50) /50)] === 0)) - || (direction === DIRECTIONS.RIGHT && (world[(pManCurrPosY)/50][((pManCurrPosX + 50) /50)] === 0)) - || (direction === DIRECTIONS.UP && (world[(pManCurrPosY - 50)/50][(pManCurrPosX/50)] === 0)) - || (direction === DIRECTIONS.DOWN && (world[(pManCurrPosY + 50)/50][(pManCurrPosX/50)] === 0))) { - direction = DIRECTIONS.IDLE - } - switch (direction) { - case DIRECTIONS.IDLE: - addX = 0; - addY = 0; - break; - case DIRECTIONS.LEFT : - addX = -(maxVelocity); - addY = 0; - break; - case DIRECTIONS.RIGHT: - addX = (maxVelocity); - addY = 0; - break; - case DIRECTIONS.UP: - addX = 0; - addY = -(maxVelocity); - break; - case DIRECTIONS.DOWN: - addX = 0; - addY = (maxVelocity); - break; - default: - addX = 0; - addY = 0; - break; - - } - pManCurrPosX += (addX); - pManCurrPosY += (addY); -} - - -function keyPressed() +function keyPressed() // controls for Pacman and increases score each time Pacman moves onto a block with a coin { if(keyCode === DOWN_ARROW){ @@ -231,4 +175,4 @@ function keyPressed() score++; } -} \ No newline at end of file +} From 3108c82ee877f4821761ea90aca18135c2522ba1 Mon Sep 17 00:00:00 2001 From: shhhushhh <57884384+shhhushhh@users.noreply.github.com> Date: Wed, 28 Jul 2021 20:48:50 -0700 Subject: [PATCH 4/7] Update script.js --- script.js | 1 - 1 file changed, 1 deletion(-) diff --git a/script.js b/script.js index c6d0d35..8c67856 100644 --- a/script.js +++ b/script.js @@ -1,4 +1,3 @@ -// Name any p5.js functions we use in `global` so Glitch can recognize them. /* global * background, createCanvas, ellipse, noFill, stroke, strokeWeight, rect, image, loadImage, fill, colorMode, HSB, y, keyCode, pManCurrX, circle, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, pinkGhostRight */ From d9cf301e9eb501457a045fedae6e070db7ac7865 Mon Sep 17 00:00:00 2001 From: shhhushhh <57884384+shhhushhh@users.noreply.github.com> Date: Wed, 28 Jul 2021 20:51:31 -0700 Subject: [PATCH 5/7] Update script.js --- script.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script.js b/script.js index 8c67856..735b06b 100644 --- a/script.js +++ b/script.js @@ -83,10 +83,10 @@ function setup() pacManUp = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-up.png?v=1626464840140"); pacManDown = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-down.png?v=1626464843374"); pacManLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2Fpacman-left.png?v=1626464841802"); - pinkGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(1).png?v=1626475038102"); - pinkGhostLeft = loadImage("hhttps://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(2).png?v=1626475111582"); - blueGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky.png?v=1626475215111"); - blueGhostLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky%20(1)%20.png?v=1626475290188"); +// pinkGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(1).png?v=1626475038102"); +// pinkGhostLeft = loadImage("hhttps://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FPinky%20(2).png?v=1626475111582"); +// blueGhostRight = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky.png?v=1626475215111"); +// blueGhostLeft = loadImage("https://cdn.glitch.com/6ed26b30-fe55-4022-8423-cd86038b8441%2FBlinky%20(1)%20.png?v=1626475290188"); pacmanAvatar = pacManRight; score = 0; @@ -95,8 +95,8 @@ function setup() function draw(){ // continuously draws the maze background(0); image(pacmanAvatar, pManCurrPosX, pManCurrPosY, 50, 50); - image(pinkGhostRight, pinkGhostPosX, pinkGhostPosY, 50, 50); - image(blueGhostLeft, blueGhostPosX, blueGhostPosY, 50, 50); +// image(pinkGhostRight, pinkGhostPosX, pinkGhostPosY, 50, 50); +// image(blueGhostLeft, blueGhostPosX, blueGhostPosY, 50, 50); drawMap(); fill(255,100,100) rect(675,0,100,100) From b02332a771f77a7ea7a77e6fe7724c581854a723 Mon Sep 17 00:00:00 2001 From: shhhushhh <57884384+shhhushhh@users.noreply.github.com> Date: Wed, 28 Jul 2021 20:53:08 -0700 Subject: [PATCH 6/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 03c14c8..1b7cf8f 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Your Project ### ← README.md Not much to say other than it's a scuffed version of Pacman :D I mainly worked on creating the world array, the drawMap() function, and implementing the coins. +You can play the game on the Glitch IDE: https://glitch.com/edit/#!/pacman-sample ### ← index.html From 084bb41ccc0966151d714d17d99c4e0417f14db0 Mon Sep 17 00:00:00 2001 From: shhhushhh <57884384+shhhushhh@users.noreply.github.com> Date: Wed, 28 Jul 2021 20:53:43 -0700 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b7cf8f..f59c889 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Your Project ### ← README.md Not much to say other than it's a scuffed version of Pacman :D I mainly worked on creating the world array, the drawMap() function, and implementing the coins. -You can play the game on the Glitch IDE: https://glitch.com/edit/#!/pacman-sample +You can play the game on the Glitch IDE: https://pacman-sample.glitch.me ### ← index.html