Skip to content

Commit

Permalink
feat: Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake committed Sep 13, 2024
0 parents commit bb3a96e
Show file tree
Hide file tree
Showing 157 changed files with 9,005 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
env:
node: true
extends:
- 'eslint:recommended'
- 'plugin:@typescript-eslint/recommended'
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 12
sourceType: module
project:
- 'tsconfig.json'
plugins:
- '@typescript-eslint'
rules:
'@typescript-eslint/no-explicit-any': 0
'@typescript-eslint/explicit-module-boundary-types': 0
'@typescript-eslint/ban-ts-comment': 0
'@typescript-eslint/switch-exhaustiveness-check': 1
no-invalid-regexp: warn
no-unreachable: warn
no-eval: warn
vars-on-top: warn
'@typescript-eslint/no-unused-vars':
- warn
- args: none
indent:
- warn
- 2
- SwitchCase: 1
quotes:
- warn
- single
semi:
- warn
- always
- omitLastInOneLineBlock: true
no-var: error
prefer-const: warn
prefer-template: error
no-prototype-builtins: 0
max-len: ['warn', 100, 2, { 'ignoreComments': true, 'ignoreStrings': true }]
51 changes: 51 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

DS_Store
dist/
.yarn/
31 changes: 31 additions & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
language="nodejs"
run="yarn host"

entrypoint="./TowerDefense/src/main.ts"
modules = ["nodejs-20:v8-20230920-bd784b9"]

[languages.typescript]
pattern = "**/{*.ts,*.js,*.tsx,*.jsx}"
syntax = "typescript"

[languages.scss]
pattern = "**/{*.scss,*.sass}"
syntax = "scss"

[languages.typescript.languageServer]
start = [ "typescript-language-server", "--stdio" ]

[packager]
language = "nodejs"

[packager.features]
enabledForHosting = false
packageSearch = true
guessImports = false

[nix]
channel = "stable-21_11"

[[ports]]
localPort = 8080
externalPort = 80
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
9 changes: 9 additions & 0 deletions Server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const createServer = (server) => {
server.middlewares.use('/data-path', async (req, res, next) => {
res.end(JSON.stringify(req.headers));
});
server.middlewares.use('/user-data', async (req, res, next) => {
res.end(req.headers['x-replit-user-name'] ? req.headers['x-replit-user-name'] : false);
});
};
export default createServer;
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mkdir ./dist/src/
cp favicon.ico ./dist
cp -avr ./src/assets ./dist/src/assets
Binary file added favicon.ico
Binary file not shown.
182 changes: 182 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/misc/decoration-drive.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Celestron</title>
<meta name="description" content="Celestron is a replit-based tower defense"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Oxanium:wght@200;300;400;500;600;700;800&display=swap" rel="stylesheet">
</head>
<body>
<div id="app">
<!-- Menu -->
<section id="Menu">
<!--<h1 id="title">Celestron</h1>-->
<img src="/src/assets/title.svg" id="title-img" alt="Celestron Title"/>
<div id="navigator">
<button class="menu-btn" id="StartBtn">Start Game</button>
<button class="menu-btn" id="HowBtn">How to Play</button>
<button class="menu-btn" id="LeaderBoardBtn">Leaderboard</button>

<button class="menu-btn" id="CreditsBtn">Credits</button>
</div>

<button id="login-button" class="metalbtn hexagon">Log In</button>
<div id="loggedin-indicator" class="Hidden">
<img alt="profile indicator" src="/src/assets/interface/user.svg"/>
<span id="username-indicator">Username</span>
</div>
<div id="login-overlay"></div>
<div id="login-modal">
<h2>Log In</h2>
<p>If you would like to be on the leaderboard, please log in with replit.</p>
<button id="login-replit-btn" class="metalbtn hexagon">Authorize Celestron</button>
<button id="close-login-btn" class="metalbtn hexagon">Continue Anonymous</button>
</div>
</section>
<!-- Game -->
<section id="Game" class="Hidden">
<div id="interface">
<!--Tower Button-->
<div id="centerbtn">
<!-- <button id="special-attack-btn">Special</button> -->
<button id="tower-menu-btn">Towers</button>
</div>
<!--Corner Stats Interface-->
<div id="stats">
<div>
Wave <span id="wave-count">0</span><br>
<img alt="Currency Icon" src="/src/assets/interface/money.png" class="icon-money"><span class="money-count" id="money"></span>
</div>
<button class="hexagon metalbtn" style="margin-top: 10px;" id="nextwave">Next Wave</button>
</div>
<!--Zoom Buttons-->
<div id="zoom-btns">
<button id="zoomin">+</button>
<button id="zoomout">-</button>
<button id="speed">x1</button>
</div>
<!-- Store -->
<div class="Store Hidden" id="storeBody">
<div class="tflex"></div>
</div>

<!--Messages-->
<div id="message-overlay"></div>
<div id="msg" class="Hidden message">
<div style="margin-right: 10px;">
<img alt="Repler Image" id="repler-image"/>
<button id="nextmsg" class="metalbtn hexagon" style="display: block;width: 100%;margin-top: 5px;">Next</button>
</div>
<div id="flex-msg">
<div id="repler-name"></div>
<div id="repler-message"></div>
</div>
</div>
<!-- Game Over -->
<!-- <div id="message-overlay"></div> -->
<div id="gameover" class="message Hidden">
<h1>GAME OVER!</h1>
<p>Good job! Check your rank on the leaderboard!</p>
<div class="btns">
<button class="metalbtn hexagon" id="HomeBtn4">Menu</button>
</div>
</div>

<!--Pause Overlay-->
<div id="pause-overlay" class="Hidden">
<h1>Game Paused</h1>
</div>
<!--Pause Button-->
<div id="pause-button">||</div>
</div>
</section>
<!-- Credits -->
<section id="CreditsScene" class="TextPage Hidden">
<div id='stars'></div>
<div id='stars2'></div>
<div id='stars3'></div>
<button class="metalbtn hexagon" id="HomeBtn1">Home</button>
<div class="page-container">
<div class="container">
<h1 class="header">Credits</h1>
<div class="info">
<p><strong>SpotAndJake</strong> - Game Mechanics, world generation, and all the hard stuff.</p>
<p><strong>Jdog787</strong> - UI, Sound Effects, Music, Leaderboard, Server-side functions, and other random things.</p>
<p><strong>IroncladDev</strong> - Story, graphics & art, interface, and a little dabble of bug fixes everywhere.</p>
<p>Sound effects retrieved from <a href="https://storyblocks.com" target="_blank">https://storyblocks.com</a>, some altered and edited with <a href="https://mp3cut.net/" target="_blank">https://mp3cut.net/</a></p>
<p>Animated star background retrieved fromm <a href="https://codepen.io/sarazond/pen/LYGbwj">https://codepen.io/sarazond/pen/LYGbwj</a></p>
<p>&copy; SpotAndJake, JDOG787, and IroncladDev 2022. All rights Reserved.</p>
</div>
</div>
</div>
</section>
<!-- How To Play -->
<section id="HowToPlay" class="TextPage Hidden">
<div id='stars'></div>
<div id='stars2'></div>
<div id='stars3'></div>
<button class="metalbtn hexagon" id="HomeBtn2">Home</button>
<div class="page-container">
<div class="container">
<h1 class="header">How to Play</h1>
<div class="info">
<p>Your goal is to survive as many waves as possible and move your way up the leaderboard by defending replit's headquarters from bugs, malicious users and repls, and more.</p>
<p>Place towers by opening up the tower menu at the bottom of the screen. Towers will upgrade automatically after getting a certain number of kills.</p>
<p>Typically, you can use the mouse, but there are some shortcut keys:</p>
<p>
<ul>
<li>Arrow Keys : move map</li>
<li>Spacebar : dismiss messages/start wave</li>
<li>+/- : zoom</li>
</ul>
</p>
</div>
</div>
</div>
</section>
<!-- LeaderBoard -->
<section class="Hidden TextPage" id="LeaderBoard">
<div id='stars'></div>
<div id='stars2'></div>
<div id='stars3'></div>
<div class="page-container">
<div class="left">
<button class="metalbtn hexagon" id="HomeBtn3">Home</button>
<div class="profile">
<h2>Profile</h2>
<h3 id="profile-name">Username</h3>
<div class="stats">
<span>Highest Wave: <span id="profile-high">0</span></span>
</div>
</div>
</div>
<div class="right">
<div class="lb">
<h2>Leaderboard</h2>
<div class="lb-container">
<!-- <div class="row"><span>1. JDOG787</span><span>1004</span></div>
<div class="row"><span>2. JDOG787</span><span>1004</span></div>
<div class="row"><span>3. JDOG787</span><span>1004</span></div>
<div class="row"><span>4. JDOG787</span><span>1004</span></div>
<div class="row"><span>5. JDOG787</span><span>1004</span></div>
<div class="row"><span>6. JDOG787</span><span>1004</span></div>
<div class="row"><span>7. JDOG787</span><span>1004</span></div>
<div class="row"><span>8. JDOG787</span><span>1004</span></div>
<div class="row"><span>9. JDOG787</span><span>1004</span></div>
<div class="row"><span>10. JDOG787</span><span>1004</span></div>
<div class="row"><span>12. JDOG787</span><span>1004</span></div>
<div class="row"><span>13. JDOG787</span><span>1004</span></div>
<div class="row"><span>14. JDOG787</span><span>1004</span></div> -->
</div>
</div>
</div>
</div>
</section>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"type": "module",
"license": "MIT",
"scripts": {
"typecheck": "tsc --noEmit",
"dev": "vite --port 443 --host 0.0.0.0",
"build": "vite build && bash build.sh",
"preview": "yarn build && yarn host",
"lint": "eslint ./src/main.ts",
"host": "node server.js"
},
"dependencies": {
"@replit/database": "^2.0.1",
"@swc/core": "^1.2.160",
"better-replit-db": "^1.1.9",
"co-body": "^6.1.0",
"cookie-parser": "^1.4.6",
"express": "^4.17.3",
"howler": "^2.2.3",
"node-fetch": "^3.2.3",
"p5": "^1.4.1",
"vite": "^2.8.6"
},
"devDependencies": {
"@types/howler": "^2.2.7",
"@types/p5": "^1.4.1",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.11.0",
"sass": "^1.49.9",
"typescript": "^4.6.2"
}
}
Loading

0 comments on commit bb3a96e

Please sign in to comment.