🎮ArcadeLab

FIFA 26 MVP CHALLENGE - Score to win MVP

by StormRaven92
622 lines23.3 KB
▶ Play
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>FIFA 26 MVP CHALLENGE - Score to win MVP</title>
    <style>
        * {
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }
        body {
            background: radial-gradient(circle at 20% 30%, #0a2f1f, #031007);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            font-family: 'Segoe UI', 'Poppins', 'Impact', system-ui, sans-serif;
            margin: 0;
            padding: 20px;
        }
        .game-wrapper {
            background: #00000066;
            backdrop-filter: blur(5px);
            border-radius: 64px;
            padding: 20px;
            box-shadow: 0 25px 40px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.2);
        }
        canvas {
            display: block;
            margin: 0 auto;
            border-radius: 32px;
            box-shadow: 0 0 0 3px gold, 0 20px 30px black;
            cursor: none;
            background: #1c631c;
        }
        .mvp-panel {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 18px;
            flex-wrap: wrap;
            gap: 12px;
            background: #010814cc;
            padding: 10px 20px;
            border-radius: 60px;
            backdrop-filter: blur(8px);
        }
        .stat {
            background: #000000aa;
            padding: 5px 18px;
            border-radius: 32px;
            font-weight: bold;
            color: #ffeaac;
            font-family: monospace;
            font-size: 1.2rem;
        }
        .stat span {
            color: #ffd966;
            font-size: 1.9rem;
            margin-left: 8px;
            font-weight: 800;
        }
        .mvp-bar {
            background: #2c1e0e;
            border-radius: 30px;
            height: 18px;
            width: 200px;
            overflow: hidden;
            box-shadow: inset 0 1px 4px #00000066;
        }
        .mvp-fill {
            background: linear-gradient(90deg, #ffb347, #ffdd77);
            width: 0%;
            height: 100%;
            border-radius: 30px;
            transition: width 0.2s ease;
        }
        button {
            background: #ffb347;
            border: none;
            font-family: inherit;
            font-weight: bold;
            padding: 6px 20px;
            border-radius: 40px;
            color: #1f2a0a;
            font-size: 1rem;
            cursor: pointer;
            transition: 0.08s linear;
            box-shadow: 0 4px 0 #7a3b00;
            transform: translateY(-2px);
        }
        button:active {
            transform: translateY(2px);
            box-shadow: 0 1px 0 #7a3b00;
        }
        .controls {
            font-size: 0.7rem;
            background: #0a1422aa;
            padding: 4px 12px;
            border-radius: 60px;
            color: #bbd9ff;
        }
        kbd {
            background: #1e293b;
            padding: 2px 8px;
            border-radius: 30px;
            margin: 0 2px;
            font-weight: bold;
            color: #ffde9e;
        }
        @media (max-width: 700px) {
            .stat span { font-size: 1.4rem; }
            .mvp-bar { width: 140px; }
        }
    </style>
</head>
<body>
<div>
    <div class="game-wrapper">
        <canvas id="gameCanvas" width="900" height="550"></canvas>
        <div class="mvp-panel">
            <div class="stat">⚽ GOALS <span id="goalCount">0</span></div>
            <div class="stat">⭐ MVP SCORE <span id="mvpScore">0</span></div>
            <div style="display: flex; align-items: center; gap: 12px;">
                <div class="mvp-bar"><div class="mvp-fill" id="mvpFill"></div></div>
                <div class="controls">🏆 <kbd>←</kbd> <kbd>→</kbd> / <kbd>A</kbd> <kbd>D</kbd> &nbsp;&nbsp;⚡<kbd>SPACE</kbd> SHOOT</div>
            </div>
            <button id="restartMvpBtn">🔄 RESTART</button>
        </div>
        <div style="text-align: center; margin-top: 12px; color: #eedd99; font-size: 0.75rem; font-weight: bold;">
            🔥 MVP EDITION: Dribble past defenders → press SPACE to shoot and SCORE! Each goal = +10 MVP, Golden goal gives MVP boost. Avoid red cards!
        </div>
    </div>
</div>

<script>
    (function() {
        // --- CANVAS ---
        const canvas = document.getElementById('gameCanvas');
        const ctx = canvas.getContext('2d');
        const W = 900, H = 550;
        
        // --- Game state ---
        let gameActive = true;
        let goals = 0;
        let mvpPoints = 0;
        let highMvp = 0;   // not saved but dynamic
        
        // --- Player (MVP STRIKER) ---
        const PLAYER_W = 42;
        const PLAYER_H = 42;
        let playerX = W/2 - PLAYER_W/2;
        const playerY = H - PLAYER_H - 25;
        let playerSpeed = 7;
        
        // --- BALL & shooting mechanic ---
        let ball = {
            x: playerX + PLAYER_W/2 - 8,
            y: playerY - 12,
            w: 14,
            h: 14,
            active: true,    // if ball is on field / not shot
            shooting: false,
            vx: 0,
            vy: 0,
            shotTimer: 0
        };
        
        // --- DEFENDERS (opponents that try to tackle) ---
        let defenders = [];
        
        // --- GOLDEN MVP BALL (special collectible for extra MVP) ---
        let goldenMvp = { x: -100, y: -100, w: 22, h: 22, active: false, spawnTimer: 0 };
        
        // --- GOAL ZONE (top net) ---
        const goalZone = { x: W/2 - 90, y: 20, w: 180, h: 38 };
        
        // --- spawn defenders timing ---
        let defenderSpawnCounter = 0;
        
        // --- tackle cooldown flash effect (visual) ---
        let tackleFlash = 0;
        
        // ---- UI elements ----
        const goalSpan = document.getElementById('goalCount');
        const mvpSpan = document.getElementById('mvpScore');
        const mvpFillDiv = document.getElementById('mvpFill');
        
        function updateUI() {
            goalSpan.innerText = goals;
            mvpSpan.innerText = Math.floor(mvpPoints);
            let percent = Math.min(100, (mvpPoints / 200) * 100);
            mvpFillDiv.style.width = percent + "%";
            if(mvpPoints >= 200 && gameActive) {
                // MVP WIN condition!
                gameActive = false;
                // show victory message in draw later
            }
        }
        
        // --- helper: add MVP points ---
        function addMvp(amount) {
            if(!gameActive) return;
            mvpPoints += amount;
            if(mvpPoints < 0) mvpPoints = 0;
            updateUI();
            if(mvpPoints >= 200) {
                gameActive = false;
            }
        }
        
        // --- add goal + reset shot ---
        function scoreGoal(goalType = "normal") {
            if(!gameActive) return;
            goals++;
            let baseMVP = 10;
            if(goalType === "golden") baseMVP = 25;
            addMvp(baseMVP);
            // reset ball to player after goal
            resetBallToPlayer();
            // celebratory effect: clear defenders a bit? no but spawn pause small
            updateUI();
            // visual flash
            tackleFlash = 12;
        }
        
        function resetBallToPlayer() {
            ball.active = true;
            ball.shooting = false;
            ball.vx = 0;
            ball.vy = 0;
            ball.x = playerX + PLAYER_W/2 - ball.w/2;
            ball.y = playerY - 12;
        }
        
        // --- SHOOT ball (space press) ---
        function shootBall() {
            if(!gameActive) return;
            if(ball.active && !ball.shooting) {
                ball.shooting = true;
                ball.vx = (Math.random() * 3 - 1.5);   // slight random curve
                ball.vy = -9.2;
                // slight direction based on player momentum? fun
                ball.vx += (Math.random() - 0.5) * 1.2;
                // limit
                if(ball.vx > 4) ball.vx = 4;
                if(ball.vx < -4) ball.vx = -4;
            }
        }
        
        // --- DEFENDERS: they move toward player and try to steal the ball ---
        function spawnDefender() {
            let side = Math.random() < 0.5 ? 30 : W - 70;
            let xPos = side;
            let yPos = 60 + Math.random() * 200;
            defenders.push({
                x: xPos,
                y: yPos,
                w: 38,
                h: 38,
                speedX: (Math.random() * 1.8 + 1.2) * (xPos < W/2 ? 1 : -1),
                speedY: (Math.random() * 1.2 + 0.8) * (Math.random() > 0.5 ? 1 : -1),
                tackleCooldown: 0
            });
        }
        
        function updateDefenders() {
            for(let i=0; i<defenders.length; i++) {
                const d = defenders[i];
                // move toward player area (smart movement)
                let dx = (playerX + PLAYER_W/2) - (d.x + d.w/2);
                let dy = (playerY + PLAYER_H/2) - (d.y + d.h/2);
                let len = Math.hypot(dx, dy);
                if(len > 0.01) {
                    let move = Math.min(2.8, 2.2 + (mvpPoints/300));
                    d.x += (dx/len) * move;
                    d.y += (dy/len) * (move * 0.7);
                }
                // boundary clamp
                d.x = Math.min(Math.max(d.x, 10), W - d.w - 10);
                d.y = Math.min(Math.max(d.y, 40), H - 90);
                // tackle if close to player and ball active
                if(gameActive && ball.active && !ball.shooting) {
                    const playerRect = {x: playerX, y: playerY, w: PLAYER_W, h: PLAYER_H};
                    const defRect = {x: d.x, y: d.y, w: d.w, h: d.h};
                    if(rectCollide(playerRect, defRect) && d.tackleCooldown <= 0) {
                        // TACKLE! lose MVP points and ball resets
                        addMvp(-8);
                        tackleFlash = 18;
                        resetBallToPlayer();
                        d.tackleCooldown = 35;
                        // shake effect: small
                    }
                }
                if(d.tackleCooldown > 0) d.tackleCooldown--;
            }
            // remove offscreen or too far? keep them within play area anyway
            defenders = defenders.filter(d => d.y < H - 20 && d.y > 20);
        }
        
        // --- update ball physics & goal collision ---
        function updateBall() {
            if(!ball.shooting) return;
            ball.x += ball.vx;
            ball.y += ball.vy;
            ball.vy += 0.38; // gravity
            
            // wall collisions (side)
            if(ball.x <= 2) { ball.x = 2; ball.vx = -ball.vx * 0.7; }
            if(ball.x + ball.w >= W-2) { ball.x = W - ball.w - 2; ball.vx = -ball.vx * 0.7; }
            // top/bottom boundaries
            if(ball.y <= 5) {
                // goal check occurs before bounce
                if(ball.y + ball.h >= goalZone.y && ball.y <= goalZone.y+goalZone.h &&
                   ball.x + ball.w > goalZone.x && ball.x < goalZone.x+goalZone.w) {
                    // GOAL!
                    let isGolden = goldenMvp.active && rectCollide(
                        {x:ball.x,y:ball.y,w:ball.w,h:ball.h},
                        {x:goldenMvp.x,y:goldenMvp.y,w:goldenMvp.w,h:goldenMvp.h}
                    );
                    if(isGolden) {
                        scoreGoal("golden");
                        goldenMvp.active = false;
                    } else {
                        scoreGoal("normal");
                    }
                    return;
                } else {
                    ball.y = 5;
                    ball.vy = -ball.vy * 0.6;
                }
            }
            if(ball.y + ball.h >= H - 30) {
                // missed or hit ground: reset to player
                resetBallToPlayer();
                return;
            }
            // defender intercept: if ball hits defender, lose possession
            for(let i=0; i<defenders.length; i++) {
                const d = defenders[i];
                const ballRect = {x: ball.x, y: ball.y, w: ball.w, h: ball.h};
                const defRect = {x: d.x, y: d.y, w: d.w, h: d.h};
                if(rectCollide(ballRect, defRect)) {
                    resetBallToPlayer();
                    addMvp(-4);
                    tackleFlash = 10;
                    break;
                }
            }
            // golden mvp collect if ball passes through
            if(goldenMvp.active && ball.shooting && rectCollide(
                {x:ball.x,y:ball.y,w:ball.w,h:ball.h},
                {x:goldenMvp.x,y:goldenMvp.y,w:goldenMvp.w,h:goldenMvp.h}
            )) {
                // immediate golden goal effect? we'll just mark but will be triggered on goal later, but add extra mvp now
                addMvp(12);
                goldenMvp.active = false;
                tackleFlash = 8;
            }
        }
        
        // --- golden mvp spawn logic (rare) ---
        function updateGoldenMvp() {
            if(!gameActive) {
                goldenMvp.active = false;
                return;
            }
            if(goldenMvp.active) {
                goldenMvp.y += 1.6;
                if(goldenMvp.y > H || goldenMvp.y + goldenMvp.h < 0) goldenMvp.active = false;
            } else {
                if(goldenMvp.spawnTimer <= 0 && Math.random() < 0.008) {
                    goldenMvp.active = true;
                    goldenMvp.x = 40 + Math.random() * (W - goldenMvp.w - 80);
                    goldenMvp.y = -30;
                    goldenMvp.spawnTimer = 0;
                } else {
                    if(goldenMvp.spawnTimer <= 0) goldenMvp.spawnTimer = 20;
                    else goldenMvp.spawnTimer--;
                }
            }
        }
        
        // --- player movement & collision with defenders (tackle while dribbling) ---
        function updatePlayerMovement() {
            if(!gameActive) return;
            let move = 0;
            if(leftPressed) move = -1;
            if(rightPressed) move = 1;
            if(move !== 0) {
                let newX = playerX + move * playerSpeed;
                if(newX >= 5 && newX + PLAYER_W <= W - 5) playerX = newX;
                else if(newX < 5) playerX = 5;
                else if(newX + PLAYER_W > W - 5) playerX = W - PLAYER_W - 5;
            }
            // if ball is not shooting and active, make ball follow player
            if(ball.active && !ball.shooting) {
                ball.x = playerX + PLAYER_W/2 - ball.w/2;
                ball.y = playerY - 10;
            }
        }
        
        // --- spawn defenders logic (dynamic difficulty) ---
        function manageDefenderSpawning() {
            if(!gameActive) return;
            let baseDelay = 55 - Math.min(28, Math.floor(goals / 3));
            if(defenderSpawnCounter <= 0) {
                if(defenders.length < 6) spawnDefender();
                defenderSpawnCounter = Math.max(32, baseDelay);
            } else {
                defenderSpawnCounter--;
            }
        }
        
        // --- collision helper ---
        function rectCollide(r1, r2) {
            return !(r2.x > r1.x + r1.w || r2.x + r2.w < r1.x ||
                r2.y > r1.y + r1.h || r2.y + r2.h < r1.y);
        }
        
        // ---- DRAW EVERYTHING (FIFA 26 MVP style stadium) ----
        function draw() {
            ctx.clearRect(0, 0, W, H);
            // pitch pattern
            ctx.fillStyle = "#198c36";
            ctx.fillRect(0, 0, W, H);
            for(let i=0;i<20;i++) {
                ctx.fillStyle = "#22aa44";
                ctx.fillRect(i*50, (i%2)*30, 28, 22);
            }
            // penalty area
            ctx.strokeStyle = "white";
            ctx.lineWidth = 2;
            ctx.strokeRect(goalZone.x-5, goalZone.y-5, goalZone.w+10, goalZone.h+10);
            ctx.fillStyle = "#ffffff66";
            ctx.fillRect(goalZone.x, goalZone.y, goalZone.w, goalZone.h);
            ctx.fillStyle = "#FFD966";
            ctx.font = "bold 22px 'Courier New'";
            ctx.shadowBlur = 0;
            ctx.fillText("MVP ZONE", goalZone.x+40, goalZone.y+28);
            
            // defenders (red / black shirts)
            for(let d of defenders) {
                ctx.shadowBlur = 4;
                ctx.fillStyle = "#ad1f2e";
                ctx.beginPath();
                ctx.roundRect(d.x, d.y, d.w, d.h, 12);
                ctx.fill();
                ctx.fillStyle = "#2c2c2c";
                ctx.beginPath();
                ctx.roundRect(d.x+6, d.y+8, d.w-12, 8, 4);
                ctx.fill();
                ctx.fillStyle = "#f5bc70";
                ctx.font = "bold 18px monospace";
                ctx.fillText("⚔️", d.x+12, d.y+28);
            }
            
            // golden MVP ball
            if(goldenMvp.active) {
                ctx.shadowBlur = 12;
                ctx.fillStyle = "#FFBF00";
                ctx.beginPath();
                ctx.ellipse(goldenMvp.x+goldenMvp.w/2, goldenMvp.y+goldenMvp.h/2, goldenMvp.w/2, goldenMvp.h/2, 0, 0, Math.PI*2);
                ctx.fill();
                ctx.fillStyle = "#FFD966";
                ctx.beginPath();
                ctx.arc(goldenMvp.x+goldenMvp.w/2, goldenMvp.y+goldenMvp.h/2, 7, 0, Math.PI*2);
                ctx.fill();
                ctx.fillStyle = "#FFF8b0";
                ctx.font = "bold 14px monospace";
                ctx.fillText("⭐", goldenMvp.x+6, goldenMvp.y+18);
                ctx.shadowBlur = 0;
            }
            
            // ball (classic)
            ctx.shadowBlur = 4;
            ctx.fillStyle = "#F5F5DC";
            ctx.beginPath();
            ctx.arc(ball.x+ball.w/2, ball.y+ball.h/2, ball.w/2, 0, Math.PI*2);
            ctx.fill();
            ctx.fillStyle = "#26221c";
            ctx.beginPath();
            ctx.moveTo(ball.x+ball.w/2, ball.y+3);
            ctx.lineTo(ball.x+ball.w-4, ball.y+ball.h-6);
            ctx.lineTo(ball.x+5, ball.y+ball.h-6);
            ctx.fill();
            
            // player (MVP STRIKER) with glow
            if(tackleFlash > 0) {
                ctx.fillStyle = "#ffaa55";
                tackleFlash--;
            } else {
                ctx.fillStyle = "#3b6eff";
            }
            ctx.shadowBlur = 10;
            ctx.beginPath();
            ctx.roundRect(playerX, playerY, PLAYER_W, PLAYER_H, 12);
            ctx.fill();
            ctx.fillStyle = "#f9e45b";
            ctx.font = "bold 28px monospace";
            ctx.fillText("10", playerX+12, playerY+32);
            ctx.fillStyle = "white";
            ctx.beginPath();
            ctx.arc(playerX+PLAYER_W-10, playerY+12, 6, 0, Math.PI*2);
            ctx.fill();
            
            // mvp crown effect on player
            if(mvpPoints > 100) {
                ctx.fillStyle = "#FFD966";
                ctx.font = "20px sans-serif";
                ctx.fillText("👑", playerX+30, playerY-6);
            }
            
            // game over / MVP victory screen
            if(!gameActive) {
                ctx.globalAlpha = 0.85;
                ctx.fillStyle = "#030c1a";
                ctx.fillRect(0, 0, W, H);
                ctx.globalAlpha = 1;
                ctx.font = "800 38monospace";
                ctx.fillStyle = "#FFD966";
                ctx.textAlign = "center";
                if(mvpPoints >= 200) {
                    ctx.fillText("🏆 MVP CHAMPION 🏆", W/2, H/2-50);
                    ctx.font = "24px monospace";
                    ctx.fillStyle = "#fff2b5";
                    ctx.fillText("FIFA 26 MVP EDITION - YOU WON BALLON D'OR", W/2, H/2+20);
                } else {
                    ctx.fillText("GAME OVER", W/2, H/2-30);
                    ctx.font = "20px monospace";
                    ctx.fillStyle = "#ffbc6e";
                    ctx.fillText("Press RESTART to chase MVP glory", W/2, H/2+40);
                }
                ctx.fillStyle = "#fff";
                ctx.font = "18px monospace";
                ctx.fillText("⚽ Goals: "+goals+"  |  MVP Score: "+Math.floor(mvpPoints), W/2, H/2+100);
                ctx.textAlign = "left";
            }
            ctx.shadowBlur = 0;
        }
        
        // --- Game loop ---
        let leftPressed=false, rightPressed=false;
        
        function gameUpdate() {
            if(gameActive) {
                updatePlayerMovement();
                updateDefenders();
                updateBall();
                manageDefenderSpawning();
                updateGoldenMvp();
            }
            draw();
            requestAnimationFrame(gameUpdate);
        }
        
        // --- restart full game ---
        function restartMvpGame() {
            gameActive = true;
            goals = 0;
            mvpPoints = 0;
            defenders = [];
            defenderSpawnCounter = 12;
            goldenMvp.active = false;
            goldenMvp.spawnTimer = 10;
            playerX = W/2 - PLAYER_W/2;
            resetBallToPlayer();
            updateUI();
            tackleFlash = 0;
        }
        
        // --- controls ---
        function keyDownHandler(e) {
            const key = e.key;
            if(key === 'ArrowLeft' || key === 'a' || key === 'A') { leftPressed = true; e.preventDefault(); }
            else if(key === 'ArrowRight' || key === 'd' || key === 'D') { rightPressed = true; e.preventDefault(); }
            else if(key === ' ' || key === 'Space') { shootBall(); e.preventDefault(); }
            else if(key === 'r' || key === 'R') { restartMvpGame(); e.preventDefault(); }
        }
        function keyUpHandler(e) {
            const key = e.key;
            if(key === 'ArrowLeft' || key === 'a' || key === 'A') leftPressed = false;
            else if(key === 'ArrowRight' || key === 'd' || key === 'D') rightPressed = false;
        }
        
        // mouse + touch move (dribble move)
        function handleMouseMove(e) {
            if(!gameActive) return;
            const rect = canvas.getBoundingClientRect();
            const scaleX = canvas.width / rect.width;
            let mouseX = (e.clientX - rect.left) * scaleX;
            mouseX = Math.min(Math.max(mouseX, 5), W - PLAYER_W - 5);
            playerX = mouseX;
            if(ball.active && !ball.shooting) ball.x = playerX + PLAYER_W/2 - ball.w/2;
        }
        function touchMove(e) {
            e.preventDefault();
            if(!gameActive) return;
            const rect = canvas.getBoundingClientRect();
            const touch = e.touches[0];
            const scaleX = canvas.width / rect.width;
            let touchX = (touch.clientX - rect.left) * scaleX;
            touchX = Math.min(Math.max(touchX, 5), W - PLAYER_W - 5);
            playerX = touchX;
            if(ball.active && !ball.shooting) ball.x = playerX + PLAYER_W/2 - ball.w/2;
        }
        
        window.addEventListener('load', () => {
            restartMvpGame();
            window.addEventListener('keydown', keyDownHandler);
            window.addEventListener('keyup', keyUpHandler);
            canvas.addEventListener('mousemove', handleMouseMove);
            canvas.addEventListener('touchmove', touchMove, {passive: false});
            canvas.addEventListener('touchstart', e => e.preventDefault());
            document.getElementById('restartMvpBtn').addEventListener('click', () => restartMvpGame());
            gameUpdate();
        });
    })();
</script>
</body>
</html>

Game Source: FIFA 26 MVP CHALLENGE - Score to win MVP

Creator: StormRaven92

Libraries: none

Complexity: complex (622 lines, 23.3 KB)

The full source code is displayed above on this page.

Remix Instructions

To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: fifa-26-mvp-challenge-score-to-win-mvp-stormraven92" to link back to the original. Then publish at arcadelab.ai/publish.