blob: 0a4adc60395019257ec4a7250adced6018aeba24 (
plain) (
blame)
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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tower Defense</title>
<style>
body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f0f0f0;
}
.game-container {
position: relative;
display: flex;
gap: 20px;
}
#gameCanvas {
border: 2px solid #333;
background-color: white;
}
.tower-palette {
width: 100px;
background: white;
border: 2px solid #333;
padding: 10px;
display: flex;
flex-direction: column;
gap: 10px;
}
.tower-option {
width: 80px;
height: 80px;
cursor: grab;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.tower-option:active {
cursor: grabbing;
}
.tower-preview {
width: 40px;
height: 40px;
margin-bottom: 5px;
}
.tower-name {
font-size: 14px;
font-weight: bold;
margin-bottom: 3px;
}
.tower-cost {
font-size: 12px;
color: #666;
}
.start-button {
margin-top: 20px;
padding: 10px;
background-color: #2ecc71;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
width: 100%;
}
.start-button:hover {
background-color: #27ae60;
}
.start-button:disabled {
background-color: #95a5a6;
cursor: not-allowed;
}
</style>
</head>
<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>
</div>
<canvas id="gameCanvas" width="600" height="600"></canvas>
</div>
<!-- Core game modules -->
<script src="js/path.js"></script>
<script src="js/mechanics.js"></script>
<script src="js/uiHandlers.js"></script>
<!-- Rendering modules -->
<script src="js/renderer.js"></script>
<!-- Game state and main loop -->
<script src="js/gameState.js"></script>
<script src="js/game.js"></script>
</body>
</html>
|