about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2025-02-16 22:14:56 -0500
committerelioat <elioat@tilde.institute>2025-02-16 22:14:56 -0500
commitaf33663d8be0f19b319922bcf37cf0239ab2ed06 (patch)
tree7419843c16d3b02fac4d8eee0498e018bc021a9e
parent11248106343c50b43afefff232ff776b7b9192b7 (diff)
downloadtour-af33663d8be0f19b319922bcf37cf0239ab2ed06.tar.gz
*
-rw-r--r--html/tower/index.html46
-rw-r--r--html/tower/js/game.js36
-rw-r--r--html/tower/js/gameState.js34
3 files changed, 66 insertions, 50 deletions
diff --git a/html/tower/index.html b/html/tower/index.html
index a5bfb4e..04c31e6 100644
--- a/html/tower/index.html
+++ b/html/tower/index.html
@@ -32,12 +32,12 @@
             padding: 10px;
             display: flex;
             flex-direction: column;
-            gap: 10px;
+            gap: 5px;
             flex-shrink: 0;
         }
         .tower-option {
-            width: 80px;
-            height: 80px;
+            width: 60px;
+            height: 75px;
             cursor: grab;
             position: relative;
             display: flex;
@@ -49,18 +49,23 @@
             cursor: grabbing;
         }
         .tower-preview {
-            width: 40px;
-            height: 40px;
+            width: 25px;
+            height: 25px;
             margin-bottom: 5px;
         }
         .tower-name {
-            font-size: 14px;
+            font-size: 12px;
             font-weight: bold;
             margin-bottom: 3px;
         }
         .tower-cost {
-            font-size: 12px;
+            font-size: 10px;
+            color: #666;
+        }
+        .tower-ammo {
+            font-size: 10px;
             color: #666;
+            margin-top: 2px;
         }
         .start-button {
             margin-top: 20px;
@@ -85,32 +90,7 @@
 <body>
     <div class="game-container">
         <div class="tower-palette">
-            <div class="tower-option" draggable="true" data-tower-type="BASIC">
-                <div class="tower-preview" style="background: #3498db;"></div>
-                <div class="tower-name">Basic</div>
-                <div class="tower-cost">$20</div>
-            </div>
-            <div class="tower-option" draggable="true" data-tower-type="SNIPER">
-                <div class="tower-preview" style="background: #8e44ad;"></div>
-                <div class="tower-name">Sniper</div>
-                <div class="tower-cost">$40</div>
-            </div>
-            <div class="tower-option" draggable="true" data-tower-type="RAPID">
-                <div class="tower-preview" style="background: #16a085;"></div>
-                <div class="tower-name">Rapid</div>
-                <div class="tower-cost">$35</div>
-            </div>
-            <div class="tower-option" draggable="true" data-tower-type="GOOP">
-                <div class="tower-preview" style="background: #27ae60;"></div>
-                <div class="tower-name">Goop</div>
-                <div class="tower-cost">$30</div>
-            </div>
-            <div class="tower-option" draggable="true" data-tower-type="AOE">
-                <div class="tower-preview" style="background: #d35400;"></div>
-                <div class="tower-name">AOE</div>
-                <div class="tower-cost">$45</div>
-            </div>
-            <button id="startCombat" class="start-button">Start Combat</button>
+            <!-- Tower options will be populated dynamically -->
         </div>
         <canvas id="gameCanvas" width="600" height="600"></canvas>
     </div>
diff --git a/html/tower/js/game.js b/html/tower/js/game.js
index 0e79e4e..34c225d 100644
--- a/html/tower/js/game.js
+++ b/html/tower/js/game.js
@@ -228,6 +228,9 @@ function startCombat() {
  * - Method decoration (towers.push)
  */
 function initializeEventListeners() {
+    // Add this at the beginning of the function
+    populateTowerPalette();
+    
     // Set up tower palette drag events
     document.querySelectorAll('.tower-option').forEach(option => {
         option.addEventListener('dragstart', (e) => {
@@ -367,4 +370,37 @@ function renderUI(ctx, gameState) {
     ctx.fillText(`Phase: ${gameState.phase}`, 10, 90);
     ctx.fillText(`Destroyed: ${gameState.enemiesDestroyed}`, 10, 120);
     ctx.fillText(`Escaped: ${gameState.enemiesEscaped}`, 10, 150);
+}
+
+/**
+ * Dynamically populates the tower palette based on TowerTypes
+ */
+function populateTowerPalette() {
+    const palette = document.querySelector('.tower-palette');
+    // Clear existing tower options
+    palette.innerHTML = '';
+    
+    // Create tower options dynamically
+    Object.entries(TowerTypes).forEach(([type, tower]) => {
+        const towerOption = document.createElement('div');
+        towerOption.className = 'tower-option';
+        towerOption.draggable = true;
+        towerOption.dataset.towerType = type;
+        
+        towerOption.innerHTML = `
+            <div class="tower-preview" style="background: ${tower.color};"></div>
+            <div class="tower-name">${tower.name}</div>
+            <div class="tower-cost">$${tower.cost}</div>
+            <div class="tower-ammo">Ammo: ${tower.maxAmmo}</div>
+        `;
+        
+        palette.appendChild(towerOption);
+    });
+    
+    // Add start combat button
+    const startButton = document.createElement('button');
+    startButton.id = 'startCombat';
+    startButton.className = 'start-button';
+    startButton.textContent = 'Start Combat';
+    palette.appendChild(startButton);
 } 
\ No newline at end of file
diff --git a/html/tower/js/gameState.js b/html/tower/js/gameState.js
index ff64753..af5442a 100644
--- a/html/tower/js/gameState.js
+++ b/html/tower/js/gameState.js
@@ -5,53 +5,53 @@ const GamePhase = {
 
 const TowerTypes = {
     BASIC: {
-        name: 'Basic Tower',
-        cost: 20,
+        name: 'Basic',
+        cost: 5,
         range: 3,
         damage: 1,
         attackSpeed: 1,
         color: '#3498db',
-        maxAmmo: 15
+        maxAmmo: 100
     },
     SNIPER: {
-        name: 'Sniper Tower',
-        cost: 40,
+        name: 'Distance',
+        cost: 20,
         range: 6,
         damage: 2,
         attackSpeed: 0.5,
         color: '#8e44ad',
-        maxAmmo: 8
+        maxAmmo: 50
     },
     RAPID: {
-        name: 'Rapid Tower',
-        cost: 35,
+        name: 'Fast',
+        cost: 10,
         range: 2,
-        damage: 0.5,
-        attackSpeed: 2,
+        damage: 1,
+        attackSpeed: 3,
         color: '#16a085',
-        maxAmmo: 30
+        maxAmmo: 200
     },
     GOOP: {
-        name: 'Goop Tower',
-        cost: 30,
+        name: 'Goop',
+        cost: 20,
         range: 3,
         damage: 0,
         attackSpeed: 1,
         color: '#27ae60',
         special: 'slow',
         slowAmount: 0.75,
-        maxAmmo: 20
+        maxAmmo: 100
     },
     AOE: {
-        name: 'AOE Tower',
-        cost: 45,
+        name: 'AOE',
+        cost: 25,
         range: 2,
         damage: 3,
         attackSpeed: 0.3,
         color: '#d35400',
         special: 'aoe',
         aoeRadius: 4,
-        maxAmmo: 10
+        maxAmmo: 75
     }
 };
 
m> 2017-03-07 01:41:48 -0800 3761' href='/akkartik/mu/commit/html/070table.mu.html?h=main&id=9e751bb8c0cdf771d34c839cb6591d892b8e62de'>9e751bb8 ^
204dae92 ^




6c52e24e ^
204dae92 ^
9e751bb8 ^

204dae92 ^

9e751bb8 ^

204dae92 ^




6c52e24e ^
204dae92 ^
9e751bb8 ^
204dae92 ^

9e751bb8 ^

204dae92 ^


6c52e24e ^
204dae92 ^
201458e3 ^
6c52e24e ^
204dae92 ^

6c52e24e ^
204dae92 ^




6c52e24e ^
204dae92 ^


6c52e24e ^
201458e3 ^
204dae92 ^



6c52e24e ^
204dae92 ^


201458e3 ^



6c52e24e ^

204dae92 ^


6c52e24e ^
204dae92 ^


6c52e24e ^
204dae92 ^


201458e3 ^



6c52e24e ^

204dae92 ^









201458e3 ^
204dae92 ^





dcc060c7 ^


a654e4ec ^
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175