File size: 2,570 Bytes
bf2da71
64c9386
bf2da71
64c9386
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bf2da71
 
64c9386
 
 
 
 
 
 
0113737
64c9386
 
 
bf2da71
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<title>Advanced Pong</title>
<style>
  body { margin: 0; overflow: hidden; background-color: #111; cursor: none; }
  #gameArea { position: relative; width: 100vw; height: 100vh; }
  .paddle {
    position: absolute;
    width: 10px;
    height: 80px; /* Base height */
    background-color: white;
    transition: height 0.2s ease-out; /* For power-up effect */
  }
  #paddleLeft { left: 5px; }
  #paddleRight { right: 5px; }
  #ball {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: red;
    border-radius: 50%;
    box-shadow: 0 0 5px red; /* Basic glow */
  }
  /* Ball trail effect */
  #ball::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      background: red;
      opacity: 0.5;
      transform: translate(-50%, -50%) scale(1);
      filter: blur(5px);
      z-index: -1;
      transition: transform 0.1s linear, opacity 0.1s linear; /* Trail fade */
  }
  #ball.moving::after { /* Activate trail when moving */
      transform: translate(-50%, -50%) scale(1.5); /* Adjust trail size */
      opacity: 0; /* Fade out */
  }
   /* Impact flash effect */
  .impact {
    box-shadow: 0 0 15px 5px yellow !important;
    transform: scale(1.1);
  }

  #scores {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 24px;
    font-family: sans-serif;
    user-select: none;
  }
  #powerUp {
      position: absolute;
      width: 20px;
      height: 20px;
      background-color: cyan;
      border-radius: 5px;
      box-shadow: 0 0 8px cyan;
      display: none; /* Hidden initially */
  }
  #chargeIndicator {
       position: absolute;
       bottom: 20px;
       left: 20px;
       width: 50px;
       height: 10px;
       background-color: grey;
       border: 1px solid white;
       display: none; /* Hidden initially */
  }
   #chargeIndicatorFill {
       width: 0%;
       height: 100%;
       background-color: yellow;
       transition: width 0.05s linear;
   }
</style>
</head>
<body>
  <div id="gameArea">
    <div id="paddleLeft" class="paddle"></div>
    <div id="paddleRight" class="paddle"></div>
    <div id="ball"></div>
    <div id="powerUp"></div>
    <div id="scores">
      <span id="playerScore">0</span> - <span id="botScore">0</span>
    </div>
    <div id="chargeIndicator"><div id="chargeIndicatorFill"></div></div>
  </div>
  <script src="script.js"></script> <!-- Link your JS file -->
</body>
</html>