APmanageur Wi-Fi V1.0

This commit is contained in:
yoannmultigaming committed 2026-11-19 23:49:42 +01:00
1 parent 95641a8ac8
commit 1f8f295950
9 files changed
+2445 -292

No files matched your search

+587
View File
@@ -0,0 +1,587 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>T-Rex Dino Runner - AP Manageur</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
body {
background: #071326;
color: #eef4ff;
font-family: "Courier New", Courier, monospace, -apple-system, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
overflow: hidden;
padding: 10px;
}
.game-card {
background: #0d1d36;
border: 1px solid #223c68;
border-radius: 14px;
padding: 16px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(92, 167, 255, 0.15);
position: relative;
max-width: 700px;
width: 100%;
}
.header-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
font-size: 14px;
color: #9aa8c5;
}
.scores {
font-size: 18px;
font-weight: 700;
letter-spacing: 2px;
color: #5ca7ff;
}
.scores .hi {
color: #9aa8c5;
margin-right: 12px;
}
.canvas-wrap {
position: relative;
background: #f7f7f7;
border: 2px solid #223c68;
border-radius: 8px;
overflow: hidden;
transition: background 0.6s ease;
}
body.night-mode .canvas-wrap {
background: #111827;
}
canvas {
display: block;
width: 100%;
height: 220px;
cursor: pointer;
}
.controls-hint {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 12px;
font-size: 12px;
color: #9aa8c5;
flex-wrap: wrap;
gap: 8px;
}
.controls-hint kbd {
background: #132746;
border: 1px solid #223c68;
color: #fff;
padding: 2px 6px;
border-radius: 4px;
font-size: 11px;
}
.overlay-message {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(7, 19, 38, 0.85);
backdrop-filter: blur(2px);
z-index: 10;
gap: 12px;
}
.overlay-message h2 {
font-size: 22px;
color: #ff6b6b;
letter-spacing: 3px;
}
.restart-btn {
background: #5ca7ff;
color: #071326;
border: 0;
padding: 8px 20px;
border-radius: 6px;
font-weight: 700;
font-size: 14px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
}
.restart-btn:hover { background: #7ab7ff; }
</style>
</head>
<body>
<div class="game-card">
<div class="header-bar">
<div>🦖 <strong>Chrome T-Rex Runner</strong></div>
<div class="scores">
<span class="hi">HI <span id="hiScore">00000</span></span>
<span id="currentScore">00000</span>
</div>
</div>
<div class="canvas-wrap" id="canvasWrap">
<canvas id="dinoCanvas" width="640" height="220"></canvas>
<div id="gameOverlay" class="overlay-message" style="display:none">
<h2>G A M E &nbsp; O V E R</h2>
<button class="restart-btn" onclick="resetGame()">🔄 REJOUER (Espace)</button>
</div>
</div>
<div class="controls-hint">
<div><kbd>Espace</kbd> ou <kbd>⬆️</kbd> : Sauter</div>
<div><kbd>⬇️</kbd> : Se baisser / descente rapide</div>
<div>Toucher l'écran pour sauter</div>
</div>
</div>
<script>
// Audio synthesizer
let audioCtx = null;
function playTone(type) {
try {
if (!audioCtx) audioCtx = new (window.AudioContext || window.webkitAudioContext)();
if (audioCtx.state === 'suspended') audioCtx.resume();
const osc = audioCtx.createOscillator();
const gain = audioCtx.createGain();
osc.connect(gain);
gain.connect(audioCtx.destination);
const now = audioCtx.currentTime;
if (type === 'jump') {
osc.type = 'square';
osc.frequency.setValueAtTime(450, now);
osc.frequency.exponentialRampToValueAtTime(700, now + 0.08);
gain.gain.setValueAtTime(0.04, now);
gain.gain.exponentialRampToValueAtTime(0.001, now + 0.08);
osc.start(now); osc.stop(now + 0.08);
} else if (type === 'hit') {
osc.type = 'sawtooth';
osc.frequency.setValueAtTime(140, now);
osc.frequency.linearRampToValueAtTime(60, now + 0.25);
gain.gain.setValueAtTime(0.08, now);
gain.gain.exponentialRampToValueAtTime(0.001, now + 0.25);
osc.start(now); osc.stop(now + 0.25);
} else if (type === 'score') {
osc.type = 'sine';
osc.frequency.setValueAtTime(587.33, now);
osc.frequency.setValueAtTime(880, now + 0.08);
gain.gain.setValueAtTime(0.06, now);
gain.gain.exponentialRampToValueAtTime(0.001, now + 0.18);
osc.start(now); osc.stop(now + 0.18);
}
} catch (e) {}
}
const canvas = document.getElementById('dinoCanvas');
const ctx = canvas.getContext('2d');
const hiScoreEl = document.getElementById('hiScore');
const currentScoreEl = document.getElementById('currentScore');
const overlay = document.getElementById('gameOverlay');
const canvasWrap = document.getElementById('canvasWrap');
const GROUND_Y = 180;
let highScore = parseInt(localStorage.getItem('ap_dino_hi') || '0', 10);
hiScoreEl.textContent = String(highScore).padStart(5, '0');
let gameStarted = false;
let gameOver = false;
let score = 0;
let gameSpeed = 6;
let nextObstacleTimer = 0;
let isNight = false;
// Dinosaur
const dino = {
x: 40,
y: GROUND_Y - 44,
width: 44,
height: 44,
vy: 0,
gravity: 0.72,
jumpStrength: -11.5,
isGrounded: true,
isDucking: false,
legFrame: 0,
legTimer: 0
};
let obstacles = [];
let clouds = [];
let stars = [];
// Init clouds
for (let i = 0; i < 4; i++) {
clouds.push({
x: Math.random() * canvas.width,
y: 20 + Math.random() * 60,
speed: 0.5 + Math.random() * 0.8
});
}
// Init stars for night mode
for (let i = 0; i < 20; i++) {
stars.push({
x: Math.random() * canvas.width,
y: Math.random() * 120,
r: Math.random() * 1.5 + 0.5
});
}
// Ground bumps
let groundOffset = 0;
function jump() {
if (!gameStarted) {
gameStarted = true;
}
if (gameOver) {
resetGame();
return;
}
if (dino.isGrounded) {
dino.vy = dino.jumpStrength;
dino.isGrounded = false;
playTone('jump');
}
}
function duck(down) {
if (!gameStarted || gameOver) return;
dino.isDucking = down;
if (down && !dino.isGrounded) {
dino.vy += 4.5; // Fast drop
}
}
function resetGame() {
score = 0;
gameSpeed = 6;
nextObstacleTimer = 50;
obstacles = [];
dino.y = GROUND_Y - 44;
dino.vy = 0;
dino.isGrounded = true;
dino.isDucking = false;
gameOver = false;
gameStarted = true;
isNight = false;
document.body.classList.remove('night-mode');
overlay.style.display = 'none';
}
function spawnObstacle() {
const isPterodactyl = score > 250 && Math.random() < 0.35;
if (isPterodactyl) {
const flyHeights = [GROUND_Y - 26, GROUND_Y - 50, GROUND_Y - 72];
const flyY = flyHeights[Math.floor(Math.random() * flyHeights.length)];
obstacles.push({
type: 'ptero',
x: canvas.width + 20,
y: flyY,
width: 36,
height: 26,
frame: 0,
frameTimer: 0
});
} else {
const kinds = [
{ width: 16, height: 35 },
{ width: 32, height: 35 },
{ width: 48, height: 35 },
{ width: 22, height: 46 } // Tall
];
const kind = kinds[Math.floor(Math.random() * kinds.length)];
obstacles.push({
type: 'cactus',
x: canvas.width + 20,
y: GROUND_Y - kind.height,
width: kind.width,
height: kind.height
});
}
}
function checkCollision(r1, r2) {
// Small margin of forgiveness (hitbox padding)
const p = 4;
return (
r1.x + p < r2.x + r2.width &&
r1.x + r1.width - p > r2.x &&
r1.y + p < r2.y + r2.height &&
r1.y + r1.height - p > r2.y
);
}
function drawPixelDino(x, y, w, h, isDucking, legFrame, isDead) {
ctx.fillStyle = isNight ? '#e5e7eb' : '#535353';
if (isDucking && dino.isGrounded) {
// Ducking body
ctx.fillRect(x, y + 18, 54, 22);
// Head low
ctx.fillRect(x + 40, y + 10, 18, 14);
// Eye
ctx.fillStyle = isNight ? '#111827' : '#f7f7f7';
ctx.fillRect(x + 48, y + 12, 3, 3);
ctx.fillStyle = isNight ? '#e5e7eb' : '#535353';
// Legs
if (legFrame === 0) {
ctx.fillRect(x + 10, y + 36, 4, 8);
ctx.fillRect(x + 24, y + 36, 4, 8);
} else {
ctx.fillRect(x + 14, y + 36, 4, 8);
ctx.fillRect(x + 28, y + 36, 4, 8);
}
return;
}
// Normal standing / running dino
// Head
ctx.fillRect(x + 22, y, 22, 16);
ctx.fillRect(x + 18, y + 6, 6, 10);
// Eye
ctx.fillStyle = isNight ? '#111827' : '#f7f7f7';
ctx.fillRect(x + 26, y + 3, isDead ? 5 : 3, 3);
if (isDead) {
// X eye
ctx.fillRect(x + 28, y + 2, 2, 5);
}
ctx.fillStyle = isNight ? '#e5e7eb' : '#535353';
// Snout / mouth
ctx.fillRect(x + 36, y + 8, 8, 6);
// Body
ctx.fillRect(x + 10, y + 16, 22, 20);
ctx.fillRect(x + 6, y + 20, 6, 12);
ctx.fillRect(x, y + 22, 6, 8); // Tail
// Arm
ctx.fillRect(x + 28, y + 22, 8, 3);
ctx.fillRect(x + 33, y + 24, 3, 4);
// Legs
if (!dino.isGrounded) {
ctx.fillRect(x + 12, y + 36, 4, 8);
ctx.fillRect(x + 22, y + 36, 4, 8);
} else if (legFrame === 0) {
ctx.fillRect(x + 12, y + 36, 4, 8);
ctx.fillRect(x + 22, y + 36, 4, 4);
} else {
ctx.fillRect(x + 12, y + 36, 4, 4);
ctx.fillRect(x + 22, y + 36, 4, 8);
}
}
function drawCactus(x, y, w, h) {
ctx.fillStyle = isNight ? '#34d399' : '#10b981';
// Main stem
ctx.fillRect(x + w * 0.35, y, w * 0.3, h);
// Branches
if (w > 20) {
ctx.fillRect(x, y + h * 0.25, w * 0.35, h * 0.15);
ctx.fillRect(x, y + h * 0.1, w * 0.15, h * 0.25);
ctx.fillRect(x + w * 0.65, y + h * 0.4, w * 0.35, h * 0.15);
ctx.fillRect(x + w * 0.85, y + h * 0.25, w * 0.15, h * 0.25);
}
}
function drawPterodactyl(p) {
ctx.fillStyle = isNight ? '#f87171' : '#ef4444';
const x = p.x, y = p.y;
// Body
ctx.fillRect(x + 10, y + 8, 16, 8);
// Head & Beak
ctx.fillRect(x, y + 10, 10, 4);
ctx.fillRect(x + 4, y + 6, 6, 8);
// Wings
if (p.frame === 0) {
ctx.fillRect(x + 14, y, 6, 8); // Up wing
} else {
ctx.fillRect(x + 14, y + 16, 6, 10); // Down wing
}
}
function drawCloud(c) {
ctx.fillStyle = isNight ? '#374151' : '#d1d5db';
ctx.beginPath();
ctx.arc(c.x, c.y, 10, 0, Math.PI * 2);
ctx.arc(c.x + 10, c.y - 6, 12, 0, Math.PI * 2);
ctx.arc(c.x + 22, c.y, 10, 0, Math.PI * 2);
ctx.fill();
}
function update() {
if (gameStarted && !gameOver) {
// Increase speed slowly
gameSpeed += 0.0018;
score += 0.2;
const currentIntScore = Math.floor(score);
currentScoreEl.textContent = String(currentIntScore).padStart(5, '0');
// Milestone chime
if (currentIntScore > 0 && currentIntScore % 100 === 0 && Math.floor(score - 0.2) % 100 !== 0) {
playTone('score');
}
// Day/night shift
const nightPeriod = Math.floor(currentIntScore / 500) % 2 === 1;
if (nightPeriod !== isNight) {
isNight = nightPeriod;
if (isNight) document.body.classList.add('night-mode');
else document.body.classList.remove('night-mode');
}
// Dino physics
dino.vy += dino.gravity;
dino.y += dino.vy;
const effectiveH = dino.isDucking ? 26 : 44;
if (dino.y >= GROUND_Y - effectiveH) {
dino.y = GROUND_Y - effectiveH;
dino.vy = 0;
dino.isGrounded = true;
}
// Leg animation
dino.legTimer += gameSpeed;
if (dino.legTimer > 40) {
dino.legTimer = 0;
dino.legFrame = dino.legFrame === 0 ? 1 : 0;
}
// Spawn obstacles
nextObstacleTimer -= 1;
if (nextObstacleTimer <= 0) {
spawnObstacle();
nextObstacleTimer = Math.max(45, Math.floor(65 + Math.random() * 85 - (gameSpeed * 2)));
}
// Update obstacles
for (let i = obstacles.length - 1; i >= 0; i--) {
const obs = obstacles[i];
obs.x -= gameSpeed;
if (obs.type === 'ptero') {
obs.frameTimer += 1;
if (obs.frameTimer > 10) {
obs.frameTimer = 0;
obs.frame = obs.frame === 0 ? 1 : 0;
}
}
// Collision check
const dinoBox = {
x: dino.x,
y: dino.y,
width: dino.isDucking ? 54 : dino.width,
height: dino.isDucking ? 26 : dino.height
};
if (checkCollision(dinoBox, obs)) {
gameOver = true;
playTone('hit');
overlay.style.display = 'flex';
if (currentIntScore > highScore) {
highScore = currentIntScore;
localStorage.setItem('ap_dino_hi', highScore);
hiScoreEl.textContent = String(highScore).padStart(5, '0');
}
}
if (obs.x + obs.width < -30) {
obstacles.splice(i, 1);
}
}
// Move clouds
clouds.forEach(c => {
c.x -= c.speed;
if (c.x < -40) c.x = canvas.width + 20;
});
// Ground scroll
groundOffset = (groundOffset + gameSpeed) % 40;
}
// DRAW
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Stars in night mode
if (isNight) {
ctx.fillStyle = '#f9fafb';
stars.forEach(s => {
ctx.beginPath();
ctx.arc(s.x, s.y, s.r, 0, Math.PI * 2);
ctx.fill();
});
// Moon
ctx.fillStyle = '#f3f4f6';
ctx.beginPath();
ctx.arc(560, 40, 16, 0, Math.PI * 2);
ctx.fill();
ctx.fillStyle = '#111827';
ctx.beginPath();
ctx.arc(553, 37, 13, 0, Math.PI * 2);
ctx.fill();
}
// Clouds
clouds.forEach(drawCloud);
// Ground Line
ctx.strokeStyle = isNight ? '#4b5563' : '#737373';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(0, GROUND_Y);
ctx.lineTo(canvas.width, GROUND_Y);
ctx.stroke();
// Ground texture bumps
ctx.fillStyle = isNight ? '#4b5563' : '#737373';
for (let x = -groundOffset; x < canvas.width; x += 30) {
ctx.fillRect(x + 5, GROUND_Y + 4, 8, 2);
ctx.fillRect(x + 18, GROUND_Y + 9, 4, 1.5);
}
// Obstacles
obstacles.forEach(obs => {
if (obs.type === 'cactus') drawCactus(obs.x, obs.y, obs.width, obs.height);
else if (obs.type === 'ptero') drawPterodactyl(obs);
});
// Dino
drawPixelDino(dino.x, dino.y, dino.width, dino.height, dino.isDucking, dino.legFrame, gameOver);
requestAnimationFrame(update);
}
// Input handlers
window.addEventListener('keydown', e => {
if ([' ', 'ArrowUp'].includes(e.key)) {
e.preventDefault();
jump();
} else if (e.key === 'ArrowDown') {
e.preventDefault();
duck(true);
}
});
window.addEventListener('keyup', e => {
if (e.key === 'ArrowDown') {
duck(false);
}
});
canvas.addEventListener('pointerdown', e => {
e.preventDefault();
jump();
});
update();
</script>
</body>
</html>