create moveable players

This commit is contained in:
Flatlogic Bot 2025-09-23 07:15:07 +00:00
parent 6cbe7a2228
commit 2f1c0bce8c
7 changed files with 420 additions and 126 deletions

12
agent-plan.md Normal file
View File

@ -0,0 +1,12 @@
# Pocket 5 Soccer Implementation Plan
## Phase 1: MVP Development
- **Task 1**: Setup Laravel backend and establish database connections.
- **Task 2**: Develop basic React components for game UI.
- **Task 3**: Integrate a 3D game engine, ensuring minimal re-rendering issues.
- **Task 4**: Implement single-player mode with AI opponents.
- **Task 5**: Setup landing page and registration/login system.
## Phase 2: Enhanced Multiplayer
- **Task 6**: Expand multiplayer capabilities to support 1v1 matches.
- **Task 7**: Implement flexible team assignment with a mix of AI and human players.
## Phase 3: Advanced Features
- **Task 8**:

19
agent.md Normal file
View File

@ -0,0 +1,19 @@
# Pocket 5 Soccer Project Specification
## Overview
Pocket 5 Soccer is a 5v5 multiplayer soccer game, designed for quick gaming sessions on mobile and desktop platforms. The game supports both single-player and multiplayer modes, with AI-controlled players filling in any non-human positions.
## User Roles
- **Player**: The sole user role, enjoying playing against AI or other human players.
## User Stories
- **Single Player Mode**: Players can play against AI-controlled teams.
- **Multiplayer Mode**: Players can compete against each other, with the game eventually supporting up to 8 human players in a match.
## Public Interface
- **Landing Page**: Displays a demo and includes a registration/login page leading to the main game.
## Technical Stack
### Frontend
- **React**: For UI components.
- **3D Game Engine**: Used directly without React to avoid re-rendering issues, using libraries like Three.js or Babylon.js.
### Backend
- **Laravel**: Chosen for its robustness and efficient backend capabilities.
## No Third-Party Integrations or Automations
## Design Aesthetics
- Fun, casual web game style for an engaging user experience.

108
assets/css/custom.css Normal file
View File

@ -0,0 +1,108 @@
body {
font-family: 'Roboto', sans-serif;
background-color: #F8F9FA;
color: #212529;
}
h1, h2, h3, h4, h5, h6, .navbar-brand {
font-family: 'Poppins', sans-serif;
font-weight: 700;
}
.navbar {
transition: background-color 0.3s ease-in-out;
}
.hero {
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://picsum.photos/seed/soccerhero/1600/900') no-repeat center center;
background-size: cover;
color: white;
padding: 10rem 0;
text-align: center;
}
.hero h1 {
font-size: 4rem;
font-weight: 700;
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.hero p {
font-size: 1.5rem;
margin-bottom: 2rem;
}
.btn-primary {
background-color: #2ECC71;
border-color: #2ECC71;
font-weight: 700;
padding: 0.75rem 1.5rem;
transition: background-color 0.2s, border-color 0.2s;
}
.btn-primary:hover {
background-color: #27ae60;
border-color: #27ae60;
}
.btn-secondary {
background-color: #3498DB;
border-color: #3498DB;
font-weight: 700;
padding: 0.75rem 1.5rem;
transition: background-color 0.2s, border-color 0.2s;
}
.btn-secondary:hover {
background-color: #2980b9;
border-color: #2980b9;
}
section {
padding: 5rem 0;
}
.section-title {
text-align: center;
margin-bottom: 3rem;
font-size: 2.5rem;
}
.card {
border: none;
border-radius: 0.5rem;
box-shadow: 0 4px 15px rgba(0,0,0,0.08);
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.card-title {
color: #2ECC71;
}
.list-group-item {
border: none;
padding-left: 0;
}
.control-item {
background-color: #e9ecef;
padding: 1rem;
border-radius: 0.5rem;
margin-bottom: 1rem;
}
.control-item strong {
color: #3498DB;
}
footer {
background-color: #212529;
color: white;
padding: 2rem 0;
}

99
assets/js/game.js Normal file
View File

@ -0,0 +1,99 @@
import * as THREE from 'three';
// Basic Scene Setup
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x87CEEB); // Sky blue background
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(45, 25, 0);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
document.body.appendChild(renderer.domElement);
// Lighting
const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
scene.add(ambientLight);
const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2);
directionalLight.position.set(20, 30, 20);
directionalLight.castShadow = true;
directionalLight.shadow.camera.top = 20;
directionalLight.shadow.camera.bottom = -20;
directionalLight.shadow.camera.left = -20;
directionalLight.shadow.camera.right = 20;
scene.add(directionalLight);
// Field
const fieldGeometry = new THREE.PlaneGeometry(60, 100);
const fieldMaterial = new THREE.MeshStandardMaterial({ color: 0x008000 }); // Green grass
const field = new THREE.Mesh(fieldGeometry, fieldMaterial);
field.rotation.x = -Math.PI / 2;
field.receiveShadow = true;
scene.add(field);
// Player
const playerGeometry = new THREE.CapsuleGeometry(1, 2, 4, 8);
const playerMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 }); // Red player
const player = new THREE.Mesh(playerGeometry, playerMaterial);
player.position.y = 1.5; // Stand on the field
player.castShadow = true;
scene.add(player);
// Simple Bot Players (Static)
const botMaterial = new THREE.MeshStandardMaterial({ color: 0x0000ff }); // Blue bots
for (let i = 0; i < 4; i++) {
const bot = new THREE.Mesh(playerGeometry, botMaterial);
bot.position.set(
(Math.random() - 0.5) * 50,
1.5,
(Math.random() - 0.5) * 80
);
bot.castShadow = true;
scene.add(bot);
}
// Player Controls
const keyboardState = {};
window.addEventListener('keydown', (e) => { keyboardState[e.code] = true; });
window.addEventListener('keyup', (e) => { keyboardState[e.code] = false; });
const playerSpeed = 0.2;
function updatePlayerPosition() {
if (keyboardState['ArrowUp']) {
player.position.z -= playerSpeed;
}
if (keyboardState['ArrowDown']) {
player.position.z += playerSpeed;
}
if (keyboardState['ArrowLeft']) {
player.position.x -= playerSpeed;
}
if (keyboardState['ArrowRight']) {
player.position.x += playerSpeed;
}
}
// Animation Loop
function animate() {
requestAnimationFrame(animate);
updatePlayerPosition();
// Camera follows player from the sideline
camera.position.z = player.position.z;
camera.lookAt(player.position);
renderer.render(scene, camera);
}
// Handle Window Resize
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
animate();

11
assets/js/main.js Normal file
View File

@ -0,0 +1,11 @@
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});

23
game.php Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pocket 5 Soccer</title>
<style>
body { margin: 0; overflow: hidden; }
canvas { display: block; }
</style>
</head>
<body>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.163.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.163.0/examples/jsm/"
}
}
</script>
<script type="module" src="assets/js/game.js?v=<?php echo time(); ?>"></script>
</body>
</html>

272
index.php
View File

@ -1,131 +1,153 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pocket 5 Soccer - Fast-Paced 5v5 Action</title>
<meta name="description" content="Experience Pocket 5 Soccer, a real-time multiplayer 5v5 soccer game designed for quick, engaging matches on mobile and desktop.">
<!-- Bootstrap 5 CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@700&family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<!-- Open Graph Meta Tags -->
<meta property="og:title" content="Pocket 5 Soccer - Fast-Paced 5v5 Action">
<meta property="og:description" content="Real-time 5v5 multiplayer soccer. Quick matches, smart AI, and cross-platform controls.">
<meta property="og:image" content="https://picsum.photos/seed/soccermeta/1200/630">
<meta property="og:url" content="">
<meta property="og:type" content="website">
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWiZZy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-lg navbar-light bg-white fixed-top shadow-sm">
<div class="container">
<a class="navbar-brand" href="#">Pocket 5 Soccer</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#rules">Game Rules</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#controls">Controls</a>
</li>
<li class="nav-item ms-lg-3">
<a class="btn btn-primary" href="game.php">Play Now</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Hero Section -->
<header class="hero">
<div class="container">
<h1 class="display-3">Fast-Paced 5v5 Action</h1>
<p class="lead">Real-time multiplayer soccer designed for quick, intense matches.</p>
<a href="game.php" class="btn btn-primary btn-lg">Play Now</a>
<a href="#rules" class="btn btn-secondary btn-lg">Learn More</a>
</div>
</header>
<main>
<!-- Game Rules Section -->
<section id="rules">
<div class="container">
<h2 class="section-title">Game Rules & Play Style</h2>
<div class="row g-4 align-items-center">
<div class="col-lg-6">
<img src="https://picsum.photos/seed/soccerstrategy/800/600" class="img-fluid rounded shadow" alt="A top-down view of a soccer game strategy board.">
</div>
<div class="col-lg-6">
<div class="accordion" id="rulesAccordion">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Core Gameplay
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#rulesAccordion">
<div class="accordion-body">
<ul class="list-group list-group-flush">
<li class="list-group-item"><strong>Match Specs:</strong> 5v5 teams, 2-minute match duration.</li>
<li class="list-group-item"><strong>Control Model:</strong> Each human controls one player.</li>
<li class="list-group-item"><strong>Orientation:</strong> Vertical screen for mobile.</li>
<li class="list-group-item"><strong>AI Players:</strong> AI fills all positions not controlled by humans.</li>
</ul>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Advanced Mechanics
</button>
</h2>
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#rulesAccordion">
<div class="accordion-body">
<ul class="list-group list-group-flush">
<li class="list-group-item"><strong>Smart Passing:</strong> Auto-targets nearest teammate in a 30-degree arc.</li>
<li class="list-group-item"><strong>Directional Shooting:</strong> Ball trajectory follows player's facing direction.</li>
<li class="list-group-item"><strong>Active Tackle:</strong> High-speed sprint to win the ball. Failure results in a 1-second movement penalty.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Controls Section -->
<section id="controls" class="bg-white">
<div class="container">
<h2 class="section-title">Dual Platform Controls</h2>
<div class="row g-4 align-items-center">
<div class="col-lg-6 order-lg-2">
<img src="https://picsum.photos/seed/soccercontrols/800/600" class="img-fluid rounded shadow" alt="Close-up on a person's hands using a mobile phone for gaming.">
</div>
<div class="col-lg-6 order-lg-1">
<div class="row">
<div class="col-md-6">
<h4>Mobile</h4>
<div class="control-item"><strong>Movement:</strong> Virtual Joystick</div>
<div class="control-item"><strong>Actions:</strong> On-screen Buttons</div>
</div>
<div class="col-md-6">
<h4>Desktop</h4>
<div class="control-item"><strong>Movement:</strong> Arrow Keys</div>
<div class="control-item"><strong>Pass:</strong> 'S' Key</div>
<div class="control-item"><strong>Shoot:</strong> 'D' Key</div>
<div class="control-item"><strong>Tackle:</strong> Spacebar</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="text-center">
<div class="container">
<p class="mb-0">&copy; <?php echo date("Y"); ?> Pocket 5 Soccer. All Rights Reserved.</p>
</div>
</footer>
<!-- Bootstrap 5 JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS -->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>