major update :O
This commit is contained in:
BIN
static/content/buttons/hijpixel.gif
Normal file
BIN
static/content/buttons/hijpixel.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
static/content/buttons/lensdeer.gif
Normal file
BIN
static/content/buttons/lensdeer.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -3,7 +3,6 @@ https://cyber.dabamos.de/88x31/anythingbut.gif
|
||||
https://cyber.dabamos.de/88x31/bestdesktop.gif
|
||||
https://kopawz.neocities.org/buttonhoard/buttonsfldr2/diagnosedwithGAY.gif
|
||||
https://kopawz.neocities.org/indexgraphics/buttondecor/ilikecomputer.png
|
||||
https://identity-crisis.carrd.co/assets/images/gallery04/ad4f8d52.jpg?v=4e55d939
|
||||
https://anlucas.neocities.org/best_viewed_with_eyes.gif
|
||||
https://anlucas.neocities.org/html_learn_it_today.gif
|
||||
https://highway.eightyeightthirty.one/badge/5d58a8f32b007d4897db6f862a895a81674fb35f5cc3947fc66595817ca174db
|
||||
@@ -1,155 +0,0 @@
|
||||
#snakeContainer {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
canvas#snakeCanvas {
|
||||
box-sizing: border-box;
|
||||
border: 2px solid var(--secondary-background-color);
|
||||
border-radius: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min-content;
|
||||
gap: 1rem;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
form input[type="text"] {
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid var(--secondary-background-color);
|
||||
border-radius: 6px;
|
||||
background-color: var(--secondary-background-color-but-slightly-transparent);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
form button[type="submit"] {
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid var(--secondary-background-color);
|
||||
border-radius: 6px;
|
||||
background-color: var(--secondary-background-color-but-slightly-transparent);
|
||||
color: var(--text-color);
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flex-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.min-width {
|
||||
width: min-content;
|
||||
}
|
||||
|
||||
.max-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#snakeLeaderboardSection {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
max-height: 272px ;
|
||||
}
|
||||
|
||||
#snakeLeaderboard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#snakeLeaderboard li {
|
||||
padding: 5px 20px;
|
||||
background-color: var(--secondary-background-color-but-slightly-transparent);
|
||||
color: var(--text-color);
|
||||
font-size: 1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#snakeLeaderboard li:nth-child(even) {
|
||||
background-color: var(--secondary-background-color);
|
||||
}
|
||||
|
||||
dialog {
|
||||
width: 90%;
|
||||
max-width: 500px;
|
||||
padding: 20px;
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
border: 2px solid var(--secondary-background-color);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
dialog button {
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid var(--secondary-background-color);
|
||||
border-radius: 6px;
|
||||
background-color: var(--secondary-background-color-but-slightly-transparent);
|
||||
color: var(--text-color);
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
dialog h2 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
dialog p {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px) {
|
||||
.flex-row {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
form {
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.min-width {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 650px) {
|
||||
.mobileOnly {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.pcOnly {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 651px) {
|
||||
.mobileOnly {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.pcOnly {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
@@ -308,6 +308,14 @@ a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
code {
|
||||
background-color: var(--secondary-background-color-but-slightly-transparent);
|
||||
padding: 4px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.9rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1000px) {
|
||||
body {
|
||||
background-color: var(--background-color);
|
||||
@@ -1,20 +0,0 @@
|
||||
cap-widget {
|
||||
--cap-background: var(--secondary-background-color-but-slightly-transparent);
|
||||
--cap-border-color: var(--secondary-background-color);
|
||||
--cap-border-radius: 14px;
|
||||
--cap-widget-width: 230px;
|
||||
--cap-widget-padding: 14px;
|
||||
--cap-gap: 15px;
|
||||
--cap-color: var(--text-color);
|
||||
--cap-checkbox-size: 25px;
|
||||
--cap-checkbox-border: 1px solid var(--secondary-background-color);
|
||||
--cap-checkbox-border-radius: 6px;
|
||||
--cap-checkbox-background: none;
|
||||
--cap-checkbox-margin: 2px;
|
||||
--cap-font: "Space Mono", "serif";
|
||||
--cap-spinner-color: var(--primary-color);
|
||||
--cap-spinner-background-color: var(--secondary-background-color-but-slightly-transparent);
|
||||
--cap-spinner-thickness: 5px;
|
||||
--cap-credits-font-size: 12px;
|
||||
--cap-opacity-hover: 0.8;
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
.gallery {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.gallery img {
|
||||
.gallery .gallery-images {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.gallery .gallery-images img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.gallery-date {
|
||||
margin: 1rem 0 .25rem 0;
|
||||
font-size: 2rem;
|
||||
.gallery h2.gallery-date {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ if (document.getElementById('spotify')) {
|
||||
// load buttons
|
||||
|
||||
function loadButtons() {
|
||||
fetch('/static/content/other/buttons.txt').then(response => {
|
||||
fetch('/static/content/buttons/non_link_buttons.txt').then(response => {
|
||||
return response.text();
|
||||
}).then(data => {
|
||||
container = document.getElementById('button-collection');
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
const canvas = document.getElementById('snakeCanvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
const gridSize = 20;
|
||||
const tileSize = 100;
|
||||
const snakeSize = 60;
|
||||
const foodSize = 80;
|
||||
canvas.width = gridSize * tileSize;
|
||||
canvas.height = gridSize * tileSize;
|
||||
|
||||
let snake = [{ x: 10, y: 10 }, { x: 10, y: 11 }, { x: 10, y: 12 }];
|
||||
let direction = { x: 0, y: 0 };
|
||||
let food = { x: Math.floor(Math.random() * gridSize), y: Math.floor(Math.random() * gridSize) };
|
||||
let score = 0;
|
||||
let gameOver = false;
|
||||
|
||||
function draw() {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// draw grid of checkerboard pattern
|
||||
for (let x = 0; x < gridSize; x++) {
|
||||
for (let y = 0; y < gridSize; y++) {
|
||||
ctx.fillStyle = (x + y) % 2 === 0 ?
|
||||
getComputedStyle(document.documentElement).getPropertyValue('--background-color') :
|
||||
getComputedStyle(document.documentElement).getPropertyValue('--secondary-background-color');
|
||||
ctx.fillRect(x * tileSize, y * tileSize, tileSize, tileSize);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw snake
|
||||
snake.forEach(segment => {
|
||||
let nextVec = { x: 0, y: 0 };
|
||||
// if there is a segment after the current segment
|
||||
if (snake.indexOf(segment) < snake.length - 1) {
|
||||
const nextSegment = snake[snake.indexOf(segment) + 1];
|
||||
nextVec.x = nextSegment.x - segment.x;
|
||||
nextVec.y = nextSegment.y - segment.y;
|
||||
}
|
||||
|
||||
ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue('--primary-color');
|
||||
if (nextVec.x === 0 && nextVec.y === 0) {
|
||||
ctx.fillRect(
|
||||
segment.x * tileSize + (tileSize - snakeSize) / 2,
|
||||
segment.y * tileSize + (tileSize - snakeSize) / 2,
|
||||
snakeSize,
|
||||
snakeSize
|
||||
);
|
||||
} else if (nextVec.x > 0 || nextVec.y > 0) {
|
||||
ctx.fillRect(
|
||||
segment.x * tileSize + (tileSize - snakeSize) / 2,
|
||||
segment.y * tileSize + (tileSize - snakeSize) / 2,
|
||||
snakeSize + nextVec.x * (tileSize - snakeSize),
|
||||
snakeSize + nextVec.y * (tileSize - snakeSize)
|
||||
);
|
||||
} else {
|
||||
ctx.fillRect(
|
||||
segment.x * tileSize + (tileSize - snakeSize) / 2 + nextVec.x * (tileSize - snakeSize),
|
||||
segment.y * tileSize + (tileSize - snakeSize) / 2 + nextVec.y * (tileSize - snakeSize),
|
||||
snakeSize + Math.abs(nextVec.x) * (tileSize - snakeSize),
|
||||
snakeSize + Math.abs(nextVec.y) * (tileSize - snakeSize)
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Draw food
|
||||
ctx.fillStyle = '#ff4d4d';
|
||||
ctx.fillRect(
|
||||
food.x * tileSize + (tileSize - foodSize) / 2,
|
||||
food.y * tileSize + (tileSize - foodSize) / 2,
|
||||
foodSize,
|
||||
foodSize
|
||||
);
|
||||
}
|
||||
|
||||
function update() {
|
||||
if (gameOver) return;
|
||||
|
||||
// Move snake
|
||||
const head = { x: snake[0].x + direction.x, y: snake[0].y + direction.y };
|
||||
|
||||
// Add new head
|
||||
snake.unshift(head);
|
||||
|
||||
// Check for food collision
|
||||
if (head.x === food.x && head.y === food.y) {
|
||||
score += 10; // Increase score
|
||||
placeFood();
|
||||
} else {
|
||||
snake.pop(); // Remove tail if no food eaten
|
||||
}
|
||||
|
||||
// Check for wall collision
|
||||
if (head.x < 0 || head.x >= gridSize || head.y < 0 || head.y >= gridSize) {
|
||||
gameOver = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for self collision
|
||||
for (let i = 1; i < snake.length; i++) {
|
||||
if (head.x === snake[i].x && head.y === snake[i].y) {
|
||||
gameOver = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function placeFood() {
|
||||
do {
|
||||
food.x = Math.floor(Math.random() * gridSize);
|
||||
food.y = Math.floor(Math.random() * gridSize);
|
||||
} while (snake.some(segment => segment.x === food.x && segment.y === food.y));
|
||||
}
|
||||
|
||||
function changeDirection(event) {
|
||||
switch (event.key) {
|
||||
case 'w':
|
||||
if (direction.y === 0) direction = { x: 0, y: -1 };
|
||||
break;
|
||||
case 's':
|
||||
if (direction.y === 0) direction = { x: 0, y: 1 };
|
||||
break;
|
||||
case 'a':
|
||||
if (direction.x === 0) direction = { x: -1, y: 0 };
|
||||
break;
|
||||
case 'd':
|
||||
if (direction.x === 0) direction = { x: 1, y: 0 };
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Menu to start the game
|
||||
function menu() {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue('--background-color');
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue('--text-color');
|
||||
ctx.font = '200px Arial';
|
||||
ctx.fillText('Snake Game', canvas.width / 2, canvas.height / 2);
|
||||
ctx.font = '100px Arial';
|
||||
ctx.fillText('Press W/A/S/D to move', canvas.width / 2, canvas.height / 2 + 100);
|
||||
ctx.fillText('Click to start', canvas.width / 2, canvas.height / 2 + 200);
|
||||
|
||||
canvas.addEventListener('click', startGame);
|
||||
}
|
||||
|
||||
function gameLoop() {
|
||||
if (!gameOver) {
|
||||
update();
|
||||
draw();
|
||||
setTimeout(gameLoop, 100);
|
||||
} else {
|
||||
document.removeEventListener('keydown', changeDirection);
|
||||
document.getElementById('score').value = score;
|
||||
alert(`Game Over! Your score: ${score}`);
|
||||
menu();
|
||||
}
|
||||
}
|
||||
|
||||
function startGame() {
|
||||
snake = [{ x: 10, y: 10 }, { x: 10, y: 11 }, { x: 10, y: 12 }];
|
||||
direction = { x: 1, y: 0 };
|
||||
food = { x: Math.floor(Math.random() * gridSize), y: Math.floor(Math.random() * gridSize) };
|
||||
score = 0;
|
||||
gameOver = false;
|
||||
canvas.removeEventListener('click', startGame);
|
||||
document.addEventListener('keydown', changeDirection);
|
||||
gameLoop();
|
||||
}
|
||||
|
||||
menu();
|
||||
Reference in New Issue
Block a user