awacke1 commited on
Commit
8a3c54c
·
verified ·
1 Parent(s): 985632d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +58 -2
index.html CHANGED
@@ -22,12 +22,33 @@
22
  border-radius: 5px;
23
  font-family: Arial, sans-serif;
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  </style>
26
  </head>
27
  <body>
28
  <div class="hud" id="hud">
29
  <p>Current Type: <span id="currentType">Swan 🦢</span></p>
30
  </div>
 
 
 
31
 
32
  <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js"></script>
33
  <script>
@@ -48,10 +69,27 @@
48
  { type: 'grass', color: 0x98fb98 }
49
  ];
50
 
 
 
 
51
  // Particle system for motion simulation
52
  const particleSystem = new THREE.Group();
53
  scene.add(particleSystem);
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  // Create tiles and particles
56
  for (let x = 0; x < boardSize; x++) {
57
  for (let z = 0; z < boardSize; z++) {
@@ -65,7 +103,7 @@
65
  tiles.push(tile);
66
 
67
  // Add particles for motion simulation
68
- const particleGeometry = new THREE.SphereGeometry(0.1, 16, 16);
69
  const particleMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 });
70
  const particle = new THREE.Mesh(particleGeometry, particleMaterial);
71
  particle.position.set(
@@ -73,7 +111,25 @@
73
  0.2,
74
  z - boardSize / 2 + Math.random()
75
  );
76
- particle.userData = { direction: new THREE.Vector3(Math.random(), 0, Math.random()).normalize() };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  particleSystem.add(particle);
78
  }
79
  }
 
22
  border-radius: 5px;
23
  font-family: Arial, sans-serif;
24
  }
25
+ .sidebar {
26
+ position: absolute;
27
+ top: 0;
28
+ right: 0;
29
+ width: 200px;
30
+ height: 100%;
31
+ background: rgba(0, 0, 0, 0.8);
32
+ color: white;
33
+ padding: 10px;
34
+ overflow-y: auto;
35
+ font-family: Arial, sans-serif;
36
+ }
37
+ .character {
38
+ margin-bottom: 10px;
39
+ padding: 5px;
40
+ border: 1px solid white;
41
+ border-radius: 5px;
42
+ }
43
  </style>
44
  </head>
45
  <body>
46
  <div class="hud" id="hud">
47
  <p>Current Type: <span id="currentType">Swan 🦢</span></p>
48
  </div>
49
+ <div class="sidebar" id="sidebar">
50
+ <h3>Population Stats</h3>
51
+ </div>
52
 
53
  <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js"></script>
54
  <script>
 
69
  { type: 'grass', color: 0x98fb98 }
70
  ];
71
 
72
+ // Sidebar for stats
73
+ const sidebar = document.getElementById('sidebar');
74
+
75
  // Particle system for motion simulation
76
  const particleSystem = new THREE.Group();
77
  scene.add(particleSystem);
78
 
79
+ // Generate random character stats
80
+ function generateCharacter() {
81
+ const names = ["Swift Feather", "Bold Antler", "Mighty Claw", "Gentle Leaf", "Shadow Pelt"];
82
+ return {
83
+ name: names[Math.floor(Math.random() * names.length)],
84
+ attack: Math.floor(Math.random() * 10) + 1,
85
+ hitPoints: Math.floor(Math.random() * 50) + 10,
86
+ strength: Math.floor(Math.random() * 10) + 1,
87
+ intelligence: Math.floor(Math.random() * 10) + 1,
88
+ wisdom: Math.floor(Math.random() * 10) + 1,
89
+ charisma: Math.floor(Math.random() * 10) + 1,
90
+ };
91
+ }
92
+
93
  // Create tiles and particles
94
  for (let x = 0; x < boardSize; x++) {
95
  for (let z = 0; z < boardSize; z++) {
 
103
  tiles.push(tile);
104
 
105
  // Add particles for motion simulation
106
+ const particleGeometry = new THREE.SphereGeometry(0.2, 16, 16);
107
  const particleMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 });
108
  const particle = new THREE.Mesh(particleGeometry, particleMaterial);
109
  particle.position.set(
 
111
  0.2,
112
  z - boardSize / 2 + Math.random()
113
  );
114
+ particle.userData = {
115
+ direction: new THREE.Vector3(Math.random(), 0, Math.random()).normalize(),
116
+ stats: generateCharacter(),
117
+ };
118
+
119
+ // Add stats to the sidebar
120
+ const characterDiv = document.createElement('div');
121
+ characterDiv.className = 'character';
122
+ characterDiv.innerHTML = `
123
+ <strong>${particle.userData.stats.name}</strong><br>
124
+ Attack: ${particle.userData.stats.attack}<br>
125
+ HP: ${particle.userData.stats.hitPoints}<br>
126
+ Strength: ${particle.userData.stats.strength}<br>
127
+ Intelligence: ${particle.userData.stats.intelligence}<br>
128
+ Wisdom: ${particle.userData.stats.wisdom}<br>
129
+ Charisma: ${particle.userData.stats.charisma}<br>
130
+ `;
131
+ sidebar.appendChild(characterDiv);
132
+
133
  particleSystem.add(particle);
134
  }
135
  }