updted the website
This commit is contained in:
parent
affdb6e8e0
commit
d6dec54393
9 changed files with 430 additions and 71 deletions
27
footer.js
27
footer.js
|
@ -29,13 +29,40 @@ class Footer extends HTMLElement {
|
|||
<footer>
|
||||
<div class="footer-content">
|
||||
<p>2024 Interstellar Development</p>
|
||||
<!-- Hidden Button -->
|
||||
<button class="secret-button">👀</button>
|
||||
</div>
|
||||
</footer>
|
||||
</center>
|
||||
`;
|
||||
|
||||
// Add event listener for button click
|
||||
this.querySelector('.secret-button').addEventListener('click', () => {
|
||||
window.location.href = 'secret.html'; // Open the secret.html file
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('footer-component', Footer);
|
||||
|
||||
// @license-end
|
||||
|
||||
// CSS for the hidden button
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
.secret-button {
|
||||
display: none;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.footer-content:hover .secret-button {
|
||||
display: block;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
|
BIN
images/DND.png
BIN
images/DND.png
Binary file not shown.
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 310 KiB |
Binary file not shown.
Before Width: | Height: | Size: 505 KiB |
BIN
images/yasin.png
BIN
images/yasin.png
Binary file not shown.
Before Width: | Height: | Size: 571 KiB |
109
index.html
109
index.html
|
@ -1,21 +1,23 @@
|
|||
<!--
|
||||
interstellar development website
|
||||
Copyright (C) 2024 interstellar_development
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
interstellar development website
|
||||
Copyright (C) 2024 interstellar_development
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
@ -25,6 +27,7 @@
|
|||
<link rel="stylesheet" href="styles.css" />
|
||||
<title>Interstellar Development</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Custom header component -->
|
||||
<header-component></header-component>
|
||||
|
@ -36,9 +39,9 @@
|
|||
<h2>Our Games</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Previously we had unfinished Games listed here.</p>
|
||||
<p>We decided against displaying them and giving people the impression we are working on them currently.</p>
|
||||
<p>In the Future we will display the released games here</p>
|
||||
<p>Previously we had unfinished Games listed here.</p>
|
||||
<p>We decided against displaying them and giving people the impression we are working on them currently.</p>
|
||||
<p>In the Future we will display the released games here</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -49,9 +52,10 @@
|
|||
</a>
|
||||
<a href="react/" target="_blank" class="listElement">
|
||||
<li>React</li>
|
||||
</a>
|
||||
</a>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Cards section with team members -->
|
||||
<h1>Our Team</h1>
|
||||
<section class="cards" id="cards">
|
||||
|
@ -59,33 +63,23 @@
|
|||
<a href="https://interstellardevelopment.org/code/Patrick_Pluto" class="card-link" target="_blank">
|
||||
<img src="images/Patrick.png" alt="Patrick" />
|
||||
<h3>Patrick_Pluto</h3>
|
||||
<p>
|
||||
The system administrator and our lead coder. He is the one you
|
||||
will need to blame for bugs in the games
|
||||
</p>
|
||||
<p>The system administrator and our lead coder. He is the one you will need to blame for bugs in the games</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card">
|
||||
<a href="https://interstellardevelopment.org/code/sageTheDm" class="card-link" target="_blank">
|
||||
<img src="images/sage.png" alt="Sage" />
|
||||
<h3>sageTheDM</h3>
|
||||
<p>
|
||||
Our mostly competent web developer and secondary coder, if you
|
||||
experience any bugs on the website or spelling mistake he is to
|
||||
blame
|
||||
</p>
|
||||
<p>Our mostly competent web developer and secondary coder, if you experience any bugs on the website or spelling mistake he is to blame</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<a href="https://interstellardevelopment.org/code/Patrick_Pluto" class="card-link" target="_blank">
|
||||
<img src="images/nicolas.png" alt="Patrick" />
|
||||
<h3>St. Nicolaus</h3>
|
||||
<p>
|
||||
Our game level and asset designer. He is resposible for all assets in our FreeFTF game.
|
||||
So if a assets looks ugly be mad at him. Also we are not sure if he is human or just a drunk
|
||||
wizard cat but one thing is very clear he is still a novice at his job.
|
||||
</p>
|
||||
<p>Our game level and asset designer. He is responsible for all assets in our FreeFTF game. So if an asset looks ugly be mad at him. Also, we are not sure if he is human or just a drunk wizard cat but one thing is very clear he is still a novice at his job.</p>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -93,54 +87,27 @@
|
|||
<!-- About Us section -->
|
||||
<section id="about">
|
||||
<h2>About Us</h2>
|
||||
<p>
|
||||
Welcome to Interstellar Development! We are a small, passionate international team dedicated to transforming the programming world into an free-and-open-source future. Our diverse backgrounds and experiences fuel our commitment to creating free and open-source software, particularly in the realm of gaming.
|
||||
</p>
|
||||
<p>
|
||||
Our journey began with a shared vision: to better organize our efforts in making free and open-source games more efficient and accessible. We recognized that many current free software games are either lacking in quality or simply do not exist. This realization inspired us to focus on developing games that are unplayable on GNU/Linux and FreeBSD systems, as well as creating free software alternatives for those in need.
|
||||
</p>
|
||||
<p>
|
||||
At Interstellar Development, we believe that true freedom for computer users can only be achieved through the use of free software. That’s why we are committed to licensing all of our projects under copyleft free and open-source software licenses, ensuring that our games remain free for everyone to enjoy, forever.
|
||||
</p>
|
||||
<p>
|
||||
While we are not currently accepting donations, we welcome your support in the form of feedback and suggestions for improvements. If you wish to contribute financially, we encourage you to donate to the Free Software Foundation, as without them, we would have never started this.
|
||||
</p>
|
||||
<p>
|
||||
Join us as we strive to create a vibrant community around free software and gaming. Together, we can make a difference and pave the way for a free future!
|
||||
</p>
|
||||
<p>Welcome to Interstellar Development! We are a small, passionate international team dedicated to transforming the programming world into a free-and-open-source future. Our diverse backgrounds and experiences fuel our commitment to creating free and open-source software, particularly in the realm of gaming.</p>
|
||||
<p>Our journey began with a shared vision: to better organize our efforts in making free and open-source games more efficient and accessible. We recognized that many current free software games are either lacking in quality or simply do not exist. This realization inspired us to focus on developing games that are unplayable on GNU/Linux and FreeBSD systems, as well as creating free software alternatives for those in need.</p>
|
||||
<p>At Interstellar Development, we believe that true freedom for computer users can only be achieved through the use of free software. That’s why we are committed to licensing all of our projects under copyleft free and open-source software licenses, ensuring that our games remain free for everyone to enjoy, forever.</p>
|
||||
<p>While we are not currently accepting donations, we welcome your support in the form of feedback and suggestions for improvements. If you wish to contribute financially, we encourage you to donate to the Free Software Foundation, as without them, we would have never started this.</p>
|
||||
<p>Join us as we strive to create a vibrant community around free software and gaming. Together, we can make a difference and pave the way for a free future!</p>
|
||||
</section>
|
||||
|
||||
<section id="vision">
|
||||
<h2>Our Vision</h2>
|
||||
<h2>Interstellar Development: Free Software is Our Passion</h2>
|
||||
|
||||
<p>
|
||||
At Interstellar Development, we embarked on this journey to create a more organized and efficient approach to developing free and open-source software, with a particular focus on gaming. We recognized a significant gap in the availability and quality of free software games, which often fail to meet the expectations of users or simply do not exist. Our mission is to fill this void and elevate the standards of free gaming experiences.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Our primary goal is to target games that are currently unplayable on GNU/Linux and FreeBSD systems. We aim to develop high-quality alternatives that not only provide enjoyable gameplay but also adhere to the principles of free software. Additionally, we are committed to identifying and addressing other areas within the software ecosystem that lack free alternatives, ensuring that users have access to a diverse range of tools and applications that respect their freedom.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
At Interstellar Development, we firmly believe that the path to true freedom for computer users lies in the adoption and promotion of free software. To this end, we are dedicated to licensing all of our projects under copyleft free and open-source software licenses. This commitment ensures that our games and software remain free for everyone to play, modify, and share, fostering a culture of collaboration and innovation within the community.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We understand that community involvement is crucial to our success. While we are not currently accepting donations, we invite you to support us by providing feedback, reporting issues, and suggesting improvements. Your insights are invaluable in helping us refine our projects and enhance the user experience.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you feel compelled to contribute financially, we encourage you to consider donating to the Free Software Foundation. Their unwavering support and advocacy for free software principles have been instrumental in our journey, and your contributions to them help sustain the broader movement that enables us to create these games.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Together, we can build a vibrant community around free software and gaming, paving the way for a future where everyone has access to high-quality, open-source alternatives. Join us in our mission to make a difference and champion the cause of free software for all!
|
||||
</p>
|
||||
<p>At Interstellar Development, we embarked on this journey to create a more organized and efficient approach to developing free and open-source software, with a particular focus on gaming. We recognized a significant gap in the availability and quality of free software games, which often fail to meet the expectations of users or simply do not exist. Our mission is to fill this void and elevate the standards of free gaming experiences.</p>
|
||||
<p>Our primary goal is to target games that are currently unplayable on GNU/Linux and FreeBSD systems. We aim to develop high-quality alternatives that not only provide enjoyable gameplay but also adhere to the principles of free software. Additionally, we are committed to identifying and addressing other areas within the software ecosystem that lack free alternatives, ensuring that users have access to a diverse range of tools and applications that respect their freedom.</p>
|
||||
<p>At Interstellar Development, we firmly believe that the path to true freedom for computer users lies in the adoption and promotion of free software. To this end, we are dedicated to licensing all of our projects under copyleft free and open-source software licenses. This commitment ensures that our games and software remain free for everyone to play, modify, and share, fostering a culture of collaboration and innovation within the community.</p>
|
||||
<p>We understand that community involvement is crucial to our success. While we are not currently accepting donations, we invite you to support us by providing feedback, reporting issues, and suggesting improvements. Your insights are invaluable in helping us refine our projects and enhance the user experience.</p>
|
||||
<p>If you feel compelled to contribute financially, we encourage you to consider donating to the Free Software Foundation. Their unwavering support and advocacy for free software principles have been instrumental in our journey, and your contributions to them help sustain the broader movement that enables us to create these games.</p>
|
||||
<p>Together, we can build a vibrant community around free software and gaming, paving the way for a future where everyone has access to high-quality, open-source alternatives. Join us in our mission to make a difference and champion the cause of free software for all!</p>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<!-- Custom footer component -->
|
||||
<footer-component></footer-component>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
|
|
342
secret/game.js
Normal file
342
secret/game.js
Normal file
|
@ -0,0 +1,342 @@
|
|||
// Canvas setup
|
||||
const canvas = document.getElementById('gameCanvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
|
||||
// Game elements
|
||||
const player = {
|
||||
x: canvas.width / 2,
|
||||
y: canvas.height - 60,
|
||||
width: 40,
|
||||
height: 40,
|
||||
color: 'white',
|
||||
speed: 5,
|
||||
dx: 0
|
||||
};
|
||||
|
||||
let bullets = [];
|
||||
let asteroids = [];
|
||||
let items = [];
|
||||
let score = 0;
|
||||
let totalBulletsFired = 0;
|
||||
let isGameOver = false;
|
||||
let lastBulletTime = 0;
|
||||
let ammo = 100; // Ammo counter
|
||||
|
||||
// Difficulty control
|
||||
let asteroidSpawnInterval = 800; // Faster spawn rate
|
||||
let asteroidSpeedMultiplier = 1.5; // Faster asteroids from the start
|
||||
let difficultyIncreaseRate = 0.2; // Faster scaling every 10 seconds
|
||||
|
||||
// Controls
|
||||
let canShoot = true; // Flag to control shooting
|
||||
let rapidFireActive = false;
|
||||
let shotgunActive = false;
|
||||
let rainbowActive = false;
|
||||
let lastShotgunTime = 0;
|
||||
|
||||
// Controls for sphere effects
|
||||
let blueSphereCooldown = 0;
|
||||
let yellowSphereCooldown = 0;
|
||||
let greenSphereCooldown = 0;
|
||||
let rainbowSphereCooldown = 0;
|
||||
|
||||
// Sphere types
|
||||
const sphereTypes = ['blue', 'yellow', 'green', 'rainbow'];
|
||||
|
||||
// Controls
|
||||
window.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'ArrowLeft' || e.key === 'a') player.dx = -player.speed;
|
||||
if (e.key === 'ArrowRight' || e.key === 'd') player.dx = player.speed;
|
||||
|
||||
// Shoot only if it's not a hold, and we can shoot
|
||||
if (e.key === ' ' && canShoot && !isGameOver) {
|
||||
shootBullet();
|
||||
canShoot = false; // Prevent shooting until the key is released
|
||||
}
|
||||
|
||||
if (e.key === 'r' && isGameOver) restartGame();
|
||||
});
|
||||
|
||||
window.addEventListener('keyup', (e) => {
|
||||
// Stop moving when either the arrow keys or the 'a'/'d' keys are released
|
||||
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'a' || e.key === 'd') {
|
||||
player.dx = 0;
|
||||
}
|
||||
|
||||
// Allow shooting again when the space key is released
|
||||
if (e.key === ' ') {
|
||||
canShoot = true;
|
||||
}
|
||||
});
|
||||
|
||||
// Bullet mechanics with cooldown
|
||||
function shootBullet() {
|
||||
const now = Date.now();
|
||||
if (now - lastBulletTime < 100) return; // Enforce cooldown of 0.1 seconds
|
||||
if (ammo <= 0) return; // Prevent shooting if ammo is empty
|
||||
lastBulletTime = now;
|
||||
ammo--; // Decrease ammo
|
||||
|
||||
if (rapidFireActive) {
|
||||
// If rapid fire is active, fire bullets continuously with a short delay
|
||||
for (let i = 0; i < 3; i++) {
|
||||
setTimeout(() => {
|
||||
bullets.push({
|
||||
x: player.x + player.width / 2 - 2.5,
|
||||
y: player.y,
|
||||
width: 5,
|
||||
height: 10,
|
||||
color: 'yellow',
|
||||
speed: 7
|
||||
});
|
||||
}, i * 50); // Fire bullets with 50ms delay between shots
|
||||
}
|
||||
} else if (shotgunActive) {
|
||||
// Shotgun effect, firing 3 bullets with a spread
|
||||
for (let i = -1; i <= 1; i++) {
|
||||
bullets.push({
|
||||
x: player.x + player.width / 2 - 2.5,
|
||||
y: player.y,
|
||||
width: 5,
|
||||
height: 10,
|
||||
color: 'yellow',
|
||||
speed: 7,
|
||||
angle: i * 10 // Spray the bullets at different angles
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Normal bullet
|
||||
bullets.push({
|
||||
x: player.x + player.width / 2 - 2.5,
|
||||
y: player.y,
|
||||
width: 5,
|
||||
height: 10,
|
||||
color: 'yellow',
|
||||
speed: 7
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Generate random color
|
||||
function getRandomColor() {
|
||||
const colors = ['red', 'blue', 'green', 'orange', 'purple', 'pink'];
|
||||
return colors[Math.floor(Math.random() * colors.length)];
|
||||
}
|
||||
|
||||
// Asteroid mechanics
|
||||
function createAsteroid() {
|
||||
const size = Math.random() * 40 + 30; // Bigger asteroids (min: 30, max: 70)
|
||||
asteroids.push({
|
||||
x: Math.random() * canvas.width,
|
||||
y: -size,
|
||||
width: size,
|
||||
height: size,
|
||||
color: getRandomColor(),
|
||||
speed: (Math.random() * 3 + 2) * asteroidSpeedMultiplier // Faster initial speed
|
||||
});
|
||||
}
|
||||
|
||||
// Item mechanics
|
||||
function createItem() {
|
||||
const randomType = sphereTypes[Math.floor(Math.random() * sphereTypes.length)];
|
||||
const size = 30;
|
||||
const x = Math.random() * canvas.width;
|
||||
items.push({
|
||||
x: x,
|
||||
y: -size,
|
||||
width: size,
|
||||
height: size,
|
||||
type: randomType,
|
||||
color: randomType === 'blue' ? 'blue' : randomType === 'yellow' ? 'yellow' : randomType === 'green' ? 'green' : 'rainbow',
|
||||
speed: 3
|
||||
});
|
||||
}
|
||||
|
||||
// Update game elements
|
||||
function updatePlayer() {
|
||||
player.x += player.dx;
|
||||
if (player.x < 0) player.x = 0;
|
||||
if (player.x + player.width > canvas.width) player.x = canvas.width - player.width;
|
||||
}
|
||||
|
||||
function updateBullets() {
|
||||
bullets.forEach((bullet, index) => {
|
||||
bullet.y -= bullet.speed;
|
||||
if (bullet.y + bullet.height < 0) bullets.splice(index, 1);
|
||||
});
|
||||
}
|
||||
|
||||
function updateAsteroids() {
|
||||
asteroids.forEach((asteroid, index) => {
|
||||
asteroid.y += asteroid.speed;
|
||||
if (asteroid.y > canvas.height) asteroids.splice(index, 1);
|
||||
});
|
||||
}
|
||||
|
||||
function updateItems() {
|
||||
items.forEach((item, index) => {
|
||||
item.y += item.speed;
|
||||
if (item.y > canvas.height) items.splice(index, 1);
|
||||
// Check if player collects the item
|
||||
if (
|
||||
player.x < item.x + item.width &&
|
||||
player.x + player.width > item.x &&
|
||||
player.y < item.y + item.height &&
|
||||
player.y + player.height > item.y
|
||||
) {
|
||||
applyItemEffect(item.type);
|
||||
items.splice(index, 1); // Remove the item after it is collected
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyItemEffect(type) {
|
||||
if (type === 'blue') {
|
||||
rapidFireActive = true;
|
||||
setTimeout(() => rapidFireActive = false, 15000); // 15 seconds of rapid fire
|
||||
} else if (type === 'yellow') {
|
||||
shotgunActive = true;
|
||||
setTimeout(() => shotgunActive = false, 30000); // 30 seconds of shotgun
|
||||
} else if (type === 'green') {
|
||||
ammo = 100; // Refill ammo
|
||||
} else if (type === 'rainbow') {
|
||||
rapidFireActive = true;
|
||||
shotgunActive = true;
|
||||
setTimeout(() => {
|
||||
rapidFireActive = false;
|
||||
shotgunActive = false;
|
||||
}, 15000); // 15 seconds with all effects
|
||||
}
|
||||
}
|
||||
|
||||
// Collision detection
|
||||
function checkCollisions() {
|
||||
bullets.forEach((bullet, bIndex) => {
|
||||
asteroids.forEach((asteroid, aIndex) => {
|
||||
if (
|
||||
bullet.x < asteroid.x + asteroid.width &&
|
||||
bullet.x + bullet.width > asteroid.x &&
|
||||
bullet.y < asteroid.y + asteroid.height &&
|
||||
bullet.y + bullet.height > asteroid.y
|
||||
) {
|
||||
bullets.splice(bIndex, 1);
|
||||
asteroids.splice(aIndex, 1);
|
||||
score++;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
asteroids.forEach((asteroid) => {
|
||||
if (
|
||||
player.x < asteroid.x + asteroid.width &&
|
||||
player.x + player.width > asteroid.x &&
|
||||
player.y < asteroid.y + asteroid.height &&
|
||||
player.y + player.height > asteroid.y
|
||||
) {
|
||||
isGameOver = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Draw elements
|
||||
function drawPlayer() {
|
||||
ctx.fillStyle = player.color;
|
||||
ctx.fillRect(player.x, player.y, player.width, player.height);
|
||||
}
|
||||
|
||||
function drawBullets() {
|
||||
bullets.forEach((bullet) => {
|
||||
ctx.fillStyle = bullet.color;
|
||||
ctx.fillRect(bullet.x, bullet.y, bullet.width, bullet.height);
|
||||
});
|
||||
}
|
||||
|
||||
function drawAsteroids() {
|
||||
asteroids.forEach((asteroid) => {
|
||||
ctx.fillStyle = asteroid.color;
|
||||
ctx.fillRect(asteroid.x, asteroid.y, asteroid.width, asteroid.height);
|
||||
});
|
||||
}
|
||||
|
||||
function drawItems() {
|
||||
items.forEach((item) => {
|
||||
ctx.fillStyle = item.color;
|
||||
ctx.beginPath();
|
||||
ctx.arc(item.x + item.width / 2, item.y + item.height / 2, item.width / 2, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
});
|
||||
}
|
||||
|
||||
function drawScore() {
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.font = '24px Arial';
|
||||
ctx.fillText(`Score: ${score}`, 20, 40); // Score at top-left corner
|
||||
}
|
||||
|
||||
function drawAmmo() {
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.font = '24px Arial';
|
||||
ctx.fillText(`Ammo: ${ammo}`, 20, 70); // Ammo at top-left corner
|
||||
}
|
||||
|
||||
function drawGameOver() {
|
||||
if (isGameOver) {
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.font = '40px Arial';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText('Game Over!', canvas.width / 2, canvas.height / 2 - 40);
|
||||
ctx.font = '24px Arial';
|
||||
ctx.fillText(`Total Score: ${score}`, canvas.width / 2, canvas.height / 2);
|
||||
ctx.fillText(`Bullets Fired: ${totalBulletsFired}`, canvas.width / 2, canvas.height / 2 + 40);
|
||||
ctx.fillText('Press "R" to Restart', canvas.width / 2, canvas.height / 2 + 80);
|
||||
}
|
||||
}
|
||||
|
||||
// Restart game
|
||||
function restartGame() {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
// Main game loop
|
||||
function gameLoop() {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
if (!isGameOver) {
|
||||
updatePlayer();
|
||||
updateBullets();
|
||||
updateAsteroids();
|
||||
updateItems();
|
||||
checkCollisions();
|
||||
}
|
||||
|
||||
drawPlayer();
|
||||
drawBullets();
|
||||
drawAsteroids();
|
||||
drawItems();
|
||||
drawScore();
|
||||
drawAmmo();
|
||||
drawGameOver();
|
||||
|
||||
if (!isGameOver) {
|
||||
if (Math.random() < 0.02) {
|
||||
createAsteroid();
|
||||
}
|
||||
|
||||
if (Math.random() < 0.02) {
|
||||
createItem();
|
||||
}
|
||||
}
|
||||
|
||||
// Difficulty increase over time
|
||||
if (score > 0 && score % 50 === 0) {
|
||||
asteroidSpawnInterval -= difficultyIncreaseRate; // Increase spawn rate (faster asteroids)
|
||||
asteroidSpeedMultiplier += difficultyIncreaseRate; // Increase speed multiplier
|
||||
}
|
||||
|
||||
requestAnimationFrame(gameLoop);
|
||||
}
|
||||
|
||||
// Start the game
|
||||
gameLoop();
|
13
secret/secret.html
Normal file
13
secret/secret.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Asteroid Shooter</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="gameCanvas"></canvas>
|
||||
<script src="game.js"></script>
|
||||
</body>
|
||||
</html>
|
10
secret/style.css
Normal file
10
secret/style.css
Normal file
|
@ -0,0 +1,10 @@
|
|||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
background: black;
|
||||
}
|
||||
|
Loading…
Reference in a new issue