Compare commits
8 Commits
v0.2.2
...
f1346a628c
| Author | SHA1 | Date | |
|---|---|---|---|
| f1346a628c | |||
| 343af77bd1 | |||
| 47fd5c7458 | |||
| a754319374 | |||
| 4aeed537d7 | |||
| f725b4e922 | |||
| 8252f38bb7 | |||
| e4d9afdd68 |
+1
-1
@@ -14,9 +14,9 @@ RUN npm run build
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY index.html .
|
||||
COPY default.css .
|
||||
|
||||
RUN mkdir -p /usr/share/nginx/html/public
|
||||
COPY src/*.css ./public
|
||||
|
||||
RUN cp /app/build/* ./public
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ body {
|
||||
padding: 8px;
|
||||
line-height: 21px;
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#top {
|
||||
@@ -34,9 +35,19 @@ body {
|
||||
}
|
||||
|
||||
#main {
|
||||
margin: 0px 120px;
|
||||
display: flex;
|
||||
/*background: #1e2030;*/
|
||||
}
|
||||
|
||||
.canvas {
|
||||
width: 780px;
|
||||
height: 600px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.cardStats {
|
||||
font-size: 18px;
|
||||
}
|
||||
@@ -121,9 +132,7 @@ a.button {
|
||||
.card {
|
||||
background: #363a4f;
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
border-top-left-radius: 18px;
|
||||
border-top-right-radius: 18px;
|
||||
border-radius: 18px;
|
||||
animation: card 3s linear infinite;
|
||||
width: 800px;
|
||||
height: 800px;
|
||||
+12
-2
@@ -3,17 +3,18 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Trianta</title>
|
||||
<link rel="stylesheet" href="public/home.css" />
|
||||
<link rel="stylesheet" href="default.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="navigation">
|
||||
<p class="navItem" style="text-align: left; flex-grow: 1;">Trianta</p>
|
||||
<a class="navItem" href="https://www.github.com/trimutex">GitHub</a>
|
||||
<a class="navItem" href="https://lab.trianta.dev/Trianta">Projects</a>
|
||||
<p class="navItem" style="text-align: right; flex-grow: 1;">Trianta</p>
|
||||
</div>
|
||||
<div id="main">
|
||||
<div class="card">
|
||||
<h2 class="cardTop">Pong</h2>
|
||||
<div class="canvas">
|
||||
<canvas width="750" height="585" id="pong"></canvas>
|
||||
<script src="public/pong.js"></script>
|
||||
<div id="gameover" hidden="true">
|
||||
@@ -22,14 +23,23 @@
|
||||
<div id="restart" hidden="true">
|
||||
<button class="button" type="button" onclick = "restartGame()">Restart Game</a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="cardStats">Left Paddle Height: <span id="leftPaddle"></span></p>
|
||||
<p class="cardStats">Right Paddle Height: <span id="rightPaddle"></span></p>
|
||||
<a class="navItem" href="https://lab.trianta.dev/Trianta/trianta.dev/src/branch/main/src/pong.js">View Code</a>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2 class="cardTop">Snake</h2>
|
||||
<div class="canvas">
|
||||
<canvas width="625" height="375" id="snake"></canvas>
|
||||
<script src="public/snake.js"></script>
|
||||
</div>
|
||||
<p class="cardStats">
|
||||
Adjust game size -- Width:
|
||||
<input class="cardStats" id="snakeWidth" type="number" min="2" max="31" value="25">
|
||||
Height:
|
||||
<input class="cardStats" id="snakeHeight" type="number" min="2" max="24" value="15">
|
||||
</p>
|
||||
<p class="cardStats">Snake Head Location: <span id="snakeHead"></span></p>
|
||||
<p class="cardStats">Food Location: <span id="snakeFood"></span></p>
|
||||
<a class="navItem" href="https://lab.trianta.dev/Trianta/trianta.dev/src/branch/main/src/snake.ts">View Code</a>
|
||||
|
||||
Generated
+5
-5
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"name": "trianta.dev",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "trianta.dev",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.5.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
|
||||
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
|
||||
"version": "5.6.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
|
||||
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "trianta.dev",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"description": "My personal website",
|
||||
"main": "index.html",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background: black;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
background: blue;
|
||||
color: white;
|
||||
padding: 15px 20px;
|
||||
font-size: 32px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
+16
-1
@@ -169,6 +169,21 @@ class SnakeCore {
|
||||
document.getElementById("snakeHead").innerHTML = "x: " + this.body[this.body.length - 1].x + " y: " + this.body[this.body.length - 1].y;
|
||||
document.getElementById("snakeFood").innerHTML = "x: " + this.food.x + " y: " + this.food.y ;
|
||||
}
|
||||
|
||||
// Update width and height from page to match game
|
||||
getPageNumbers() {
|
||||
let specifiedWidth = parseInt((document.getElementById("snakeWidth") as HTMLInputElement).value);
|
||||
let specifiedHeight = parseInt((document.getElementById("snakeHeight") as HTMLInputElement).value);
|
||||
if (this.width == specifiedWidth && this.height == specifiedHeight)
|
||||
return false;
|
||||
this.width = specifiedWidth;
|
||||
this.height = specifiedHeight;
|
||||
while (this.height > this.board.length)
|
||||
this.board.push(new Array(this.width));
|
||||
this.canvas.setAttribute("width", String(specifiedWidth * this.grid));
|
||||
this.canvas.setAttribute("height", String(specifiedHeight * this.grid));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class Bot {
|
||||
@@ -270,7 +285,7 @@ const g_snakebot: Bot = new Bot();
|
||||
// game loop
|
||||
function snakeloop() {
|
||||
// Reset of needed
|
||||
if (g_snake.gameover)
|
||||
if (g_snake.gameover || g_snake.getPageNumbers())
|
||||
g_snake.reset();
|
||||
|
||||
// Simulate movement of snake
|
||||
|
||||
Reference in New Issue
Block a user