mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2025-12-16 22:17:48 +01:00
ball
This commit is contained in:
parent
1495f3ca64
commit
3564ef6ee2
@ -10,6 +10,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
const loginPasswordInput = document.getElementById('login-password');
|
const loginPasswordInput = document.getElementById('login-password');
|
||||||
const loginForm = document.getElementById('login-form');
|
const loginForm = document.getElementById('login-form');
|
||||||
const registerForm = document.getElementById('register-form');
|
const registerForm = document.getElementById('register-form');
|
||||||
|
const formBlock = document.getElementById('block-form');
|
||||||
|
|
||||||
|
|
||||||
let socket;
|
let socket;
|
||||||
let token;
|
let token;
|
||||||
@ -173,6 +175,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
//await createPlayer(nickname);
|
//await createPlayer(nickname);
|
||||||
registerForm.style.display = 'none';
|
registerForm.style.display = 'none';
|
||||||
gameContainer.style.display = 'flex';
|
gameContainer.style.display = 'flex';
|
||||||
|
formBlock.style.display = 'none';
|
||||||
startWebSocketConnection(token);
|
startWebSocketConnection(token);
|
||||||
} else {
|
} else {
|
||||||
alert('Registration failed. Please try again.');
|
alert('Registration failed. Please try again.');
|
||||||
@ -208,6 +211,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
if (result) {
|
if (result) {
|
||||||
loginForm.style.display = 'none';
|
loginForm.style.display = 'none';
|
||||||
gameContainer.style.display = 'flex';
|
gameContainer.style.display = 'flex';
|
||||||
|
formBlock.style.display = 'none';
|
||||||
startWebSocketConnection(token);
|
startWebSocketConnection(token);
|
||||||
} else {
|
} else {
|
||||||
alert('Authentication failed. Please try again.');
|
alert('Authentication failed. Please try again.');
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
@ -9,22 +10,20 @@
|
|||||||
<div class="logo">
|
<div class="logo">
|
||||||
<img src="{% static 'logo-42-perpignan.png' %}" alt="Logo">
|
<img src="{% static 'logo-42-perpignan.png' %}" alt="Logo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
<div class="background">
|
<div class="background">
|
||||||
<div class="stars" id="stars"></div>
|
<div class="stars" id="stars"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="pong-elements">
|
<div class="pong-elements">
|
||||||
<div class="paddle paddle-left"></div>
|
<div class="paddle paddle-left"></div>
|
||||||
<div class="paddle paddle-right"></div>
|
<div class="paddle paddle-right"></div>
|
||||||
<div class="ball_anim"></div>
|
<div class="ball_anim"></div>
|
||||||
</div>
|
</div>
|
||||||
</head>
|
|
||||||
<body>
|
<div class="container" id="block-form">
|
||||||
<div class="background">
|
|
||||||
<div class="stars" id="stars"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="container">
|
|
||||||
<h1>BIENVENUE DANS LE PONG 42</h1>
|
<h1>BIENVENUE DANS LE PONG 42</h1>
|
||||||
<div class="input-container">
|
<div class="input-container">
|
||||||
<div id="auth-form">
|
<div id="auth-form">
|
||||||
@ -45,6 +44,8 @@
|
|||||||
<button id="login">Login</button>
|
<button id="login">Login</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="game1" style="display: none;">
|
<div id="game1" style="display: none;">
|
||||||
<div id="gameCode" class="game-code">Game Code : </div>
|
<div id="gameCode" class="game-code">Game Code : </div>
|
||||||
<div id="player1-name" class="name">Player 1</div>
|
<div id="player1-name" class="name">Player 1</div>
|
||||||
@ -74,4 +75,5 @@
|
|||||||
setInterval(createTrail, 100);
|
setInterval(createTrail, 100);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
/* General styles */
|
/* General styles */
|
||||||
body, html {
|
body,
|
||||||
|
html {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
color: #00ffff;
|
color: #00ffff;
|
||||||
background-color: #0a0a2a;
|
background-color: #0a0a2a;
|
||||||
@ -25,8 +26,17 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
padding: 10px 20px;
|
background-color: #00ffff;
|
||||||
|
color: #000033;
|
||||||
|
border: none;
|
||||||
|
padding: 1rem 2rem;
|
||||||
|
font-size: 1.5rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#game1 {
|
#game1 {
|
||||||
@ -34,6 +44,8 @@ button {
|
|||||||
height: 500px;
|
height: 500px;
|
||||||
position: relative;
|
position: relative;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
|
border: 3px solid #00ffff;
|
||||||
|
box-shadow: 0 0 30px #00ffff, inset 0 0 20px #00ffff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -57,11 +69,13 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#player1-name {
|
#player1-name {
|
||||||
left: 10px; /* Adjust player score position */
|
left: 10px;
|
||||||
|
/* Adjust player score position */
|
||||||
}
|
}
|
||||||
|
|
||||||
#player2-name {
|
#player2-name {
|
||||||
right: 10px; /* Adjust bot score position */
|
right: 10px;
|
||||||
|
/* Adjust bot score position */
|
||||||
}
|
}
|
||||||
|
|
||||||
#game2 {
|
#game2 {
|
||||||
@ -71,7 +85,8 @@ button {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 2px solid red; /* Add red border */
|
border: 2px solid white;
|
||||||
|
/* Add red border */
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -84,11 +99,13 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#player1-score {
|
#player1-score {
|
||||||
left: 50px; /* Adjust player score position */
|
left: 50px;
|
||||||
|
/* Adjust player score position */
|
||||||
}
|
}
|
||||||
|
|
||||||
#player2-score {
|
#player2-score {
|
||||||
right: 50px; /* Adjust bot score position */
|
right: 50px;
|
||||||
|
/* Adjust bot score position */
|
||||||
}
|
}
|
||||||
|
|
||||||
.pad {
|
.pad {
|
||||||
@ -109,7 +126,7 @@ button {
|
|||||||
#ball {
|
#ball {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background-color: #ff0000;
|
background-color: #ffffff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
@ -190,17 +207,24 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes paddleMove {
|
@keyframes paddleMove {
|
||||||
0% { transform: translateY(10vh); }
|
0% {
|
||||||
100% { transform: translateY(70vh); }
|
transform: translateY(10vh);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: translateY(70vh);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes ballMove {
|
@keyframes ballMove {
|
||||||
0% {
|
0% {
|
||||||
transform: translateZ(0) scale(1);
|
transform: translateZ(0) scale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
50% {
|
50% {
|
||||||
transform: translateZ(-500px) scale(0.5);
|
transform: translateZ(-500px) scale(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
transform: translateZ(0) scale(1);
|
transform: translateZ(0) scale(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user