-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐ add : ํ๋ก์ ํธ ์ต์ด ๋ฑ๋ก
- Loading branch information
0 parents
commit 8a0b411
Showing
21 changed files
with
773 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"arrowParens": "always", | ||
"semi": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "nbc5_websocket_game", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "src/app.js", | ||
"scripts": { | ||
"dev": "nodemon src/app.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"type": "module", | ||
"dependencies": { | ||
"dotenv": "^16.4.5", | ||
"express": "^4.19.2", | ||
"socket.io": "^4.7.5", | ||
"uuid": "^10.0.0" | ||
}, | ||
"devDependencies": { | ||
"nodemon": "^3.1.3", | ||
"prettier": "^3.3.1" | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta name="author" content="Changmin Kang" /> | ||
<title>๋ด์ผ๋ฐฐ์์บ ํ Node.js ํธ๋ ํ์ ๋ํ์ค ๊ฒ์</title> | ||
<link rel="icon" type="image/x-icon" href="/images/favicon.ico" /> | ||
<style> | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: #2d2d2d; | ||
flex-direction: column; | ||
} | ||
#gameCanvas { | ||
border: 2px solid #000; | ||
display: none; | ||
} | ||
.button-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 20px; | ||
} | ||
.button-container button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
cursor: pointer; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="button-container"> | ||
<h1 style="color: white">๋ด์ผ๋ฐฐ์์บ ํ Node.js ํธ๋ ํ์ ๋ํ์ค ๊ฒ์</h1> | ||
<button id="registerButton">ํ์๊ฐ์ </button> | ||
<button id="loginButton">๋ก๊ทธ์ธ</button> | ||
<button id="playButton">๊ฒ์ ํ๋ ์ด</button> | ||
</div> | ||
<canvas id="gameCanvas" width="1920" height="1080"></canvas> | ||
<script src="https://cdn.socket.io/4.0.0/socket.io.min.js"></script> | ||
<script type="module"> | ||
document | ||
.getElementById("registerButton") | ||
.addEventListener("click", () => { | ||
window.location.href = "register.html"; | ||
}); | ||
|
||
document.getElementById("loginButton").addEventListener("click", () => { | ||
window.location.href = "login.html"; | ||
}); | ||
|
||
document.getElementById("playButton").addEventListener("click", () => { | ||
document.querySelector(".button-container").style.display = "none"; | ||
document.getElementById("gameCanvas").style.display = "block"; | ||
import("./src/game.js"); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta name="author" content="Changmin Kang" /> | ||
<title>๋ด์ผ๋ฐฐ์์บ ํ Node.js ํธ๋ ํ์ ๋ํ์ค ๊ฒ์</title> | ||
<link rel="icon" type="image/x-icon" href="/images/favicon.ico" /> | ||
<style> | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: #2d2d2d; | ||
color: white; | ||
font-family: Arial, sans-serif; | ||
} | ||
.form-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
.form-container input { | ||
margin: 10px; | ||
padding: 10px; | ||
font-size: 16px; | ||
} | ||
.form-container button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
cursor: pointer; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="form-container"> | ||
<h1>๋ด์ผ๋ฐฐ์์บ ํ Node.js ํธ๋ ํ์ ๋ํ์ค ๊ฒ์</h1> | ||
<h2>๋ก๊ทธ์ธ</h2> | ||
<input type="text" id="username" placeholder="์์ด๋" /> | ||
<input type="password" id="password" placeholder="๋น๋ฐ๋ฒํธ" /> | ||
<button id="login">๋ก๊ทธ์ธ</button> | ||
<button id="back">๋ค๋ก๊ฐ๊ธฐ</button> | ||
</div> | ||
<script> | ||
document.getElementById("login").addEventListener("click", () => { | ||
const username = document.getElementById("username").value; | ||
const password = document.getElementById("password").value; | ||
|
||
/* | ||
๋ก๊ทธ์ธ API ํธ์ถ ํ ๋ก๊ทธ์ธ ์ฑ๊ณต ์ index.html๋ก ์ด๋์์ผ์ฃผ์ธ์! | ||
์ด ๋, ์์ธ์ค ํ ํฐ์ ์ด๋๊ฐ์ ์ ์ฅ์ ํด๋์ผ๊ฒ ์ฃ ?! | ||
*/ | ||
}); | ||
|
||
document.getElementById("back").addEventListener("click", () => { | ||
window.location.href = "index.html"; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta name="author" content="Changmin Kang" /> | ||
<title>๋ด์ผ๋ฐฐ์์บ ํ Node.js ํธ๋ ํ์ ๋ํ์ค ๊ฒ์</title> | ||
<link rel="icon" type="image/x-icon" href="/images/favicon.ico" /> | ||
<style> | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: #2d2d2d; | ||
color: white; | ||
font-family: Arial, sans-serif; | ||
} | ||
.form-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
.form-container input { | ||
margin: 10px; | ||
padding: 10px; | ||
font-size: 16px; | ||
} | ||
.form-container button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
cursor: pointer; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="form-container"> | ||
<h1>๋ด์ผ๋ฐฐ์์บ ํ Node.js ํธ๋ ํ์ ๋ํ์ค ๊ฒ์</h1> | ||
<h2>ํ์๊ฐ์ </h2> | ||
<input type="text" id="username" placeholder="์์ด๋" /> | ||
<input type="password" id="password" placeholder="๋น๋ฐ๋ฒํธ" /> | ||
<button id="register">ํ์๊ฐ์ </button> | ||
<button id="back">๋ค๋ก๊ฐ๊ธฐ</button> | ||
</div> | ||
<script> | ||
document.getElementById("register").addEventListener("click", () => { | ||
const username = document.getElementById("username").value; | ||
const password = document.getElementById("password").value; | ||
|
||
/* | ||
ํ์๊ฐ์ API ํธ์ถ ํ ํ์๊ฐ์ ์ฑ๊ณต ์ index.html๋ก ์ด๋์์ผ์ฃผ์ธ์! | ||
*/ | ||
}); | ||
|
||
document.getElementById("back").addEventListener("click", () => { | ||
window.location.href = "index.html"; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export class Base { | ||
constructor(x, y, maxHp) { | ||
// ์์ฑ์ ์์์ ๊ธฐ์ง์ ์์ฑ์ ์ ์ํ๋ค๊ณ ์๊ฐํ์๋ฉด ๋ฉ๋๋ค! | ||
this.x = x; // ๊ธฐ์ง ์ด๋ฏธ์ง x ์ขํ | ||
this.y = y; // ๊ธฐ์ง ์ด๋ฏธ์ง y ์ขํ | ||
this.width = 170; // ๊ธฐ์ง ์ด๋ฏธ์ง ๊ฐ๋ก ๊ธธ์ด (์ด๋ฏธ์ง ํ์ผ ๊ธธ์ด์ ๋ฐ๋ผ ๋ณ๊ฒฝ ํ์ํ๋ฉฐ ์ธ๋ก ๊ธธ์ด์ ๋น์จ์ ๋ง์ถฐ์ฃผ์ ์ผ ํฉ๋๋ค!) | ||
this.height = 225; // ๊ธฐ์ง ์ด๋ฏธ์ง ์ธ๋ก ๊ธธ์ด | ||
this.hp = maxHp; // ๊ธฐ์ง์ ํ์ฌ HP | ||
this.maxHp = maxHp; // ๊ธฐ์ง์ ์ต๋ HP | ||
} | ||
|
||
draw(ctx, baseImage) { | ||
ctx.drawImage( | ||
baseImage, | ||
this.x - this.width, | ||
this.y - this.height / 2, | ||
this.width, | ||
this.height | ||
); | ||
|
||
ctx.font = "16px Arial"; | ||
ctx.fillStyle = "white"; | ||
ctx.fillText( | ||
`HP: ${this.hp}/${this.maxHp}`, | ||
this.x - this.width, | ||
this.y - this.height / 2 - 10 | ||
); | ||
} | ||
|
||
takeDamage(amount) { | ||
// ๊ธฐ์ง๊ฐ ๋ฐ๋ฏธ์ง๋ฅผ ์ ๋ ๋ฉ์๋์ ๋๋ค. | ||
// ๋ชฌ์คํฐ๊ฐ ๊ธฐ์ง์ HP๋ฅผ ๊ฐ์์ํค๊ณ , HP๊ฐ 0 ์ดํ๊ฐ ๋๋ฉด ๊ฒ์ ์ค๋ฒ ์ฒ๋ฆฌ๋ฅผ ํด์! | ||
this.hp -= amount; | ||
return this.hp <= 0; // ๊ธฐ์ง์ HP๊ฐ 0 ์ดํ์ด๋ฉด true, ์๋๋ฉด false | ||
} | ||
} |
Oops, something went wrong.