Spaces:
Running
Running
Update index.html
Browse files- index.html +53 -10
index.html
CHANGED
@@ -50,6 +50,7 @@
|
|
50 |
|
51 |
#playerHealthBar { left: 20px; }
|
52 |
#enemyHealthBar { right: 20px; }
|
|
|
53 |
#playerHealthFill { background: linear-gradient(90deg, #44f, #88f); }
|
54 |
#enemyHealthFill { background: linear-gradient(90deg, #f44, #f88); }
|
55 |
|
@@ -99,24 +100,24 @@
|
|
99 |
animation: counterAnim 0.4s linear;
|
100 |
}
|
101 |
|
102 |
-
#
|
103 |
position: fixed;
|
104 |
-
|
105 |
-
|
106 |
-
padding:
|
107 |
background: rgba(0,0,0,0.8);
|
108 |
color: white;
|
109 |
-
border-radius: 5px;
|
110 |
font-family: monospace;
|
111 |
}
|
112 |
|
113 |
-
#
|
114 |
position: fixed;
|
115 |
-
|
116 |
-
|
117 |
-
padding:
|
118 |
background: rgba(0,0,0,0.8);
|
119 |
color: white;
|
|
|
120 |
font-family: monospace;
|
121 |
}
|
122 |
|
@@ -166,7 +167,49 @@
|
|
166 |
</div>
|
167 |
|
168 |
<script>
|
169 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
</script>
|
171 |
</body>
|
172 |
</html>
|
|
|
50 |
|
51 |
#playerHealthBar { left: 20px; }
|
52 |
#enemyHealthBar { right: 20px; }
|
53 |
+
|
54 |
#playerHealthFill { background: linear-gradient(90deg, #44f, #88f); }
|
55 |
#enemyHealthFill { background: linear-gradient(90deg, #f44, #f88); }
|
56 |
|
|
|
100 |
animation: counterAnim 0.4s linear;
|
101 |
}
|
102 |
|
103 |
+
#status {
|
104 |
position: fixed;
|
105 |
+
left: 20px;
|
106 |
+
bottom: 20px;
|
107 |
+
padding: 10px;
|
108 |
background: rgba(0,0,0,0.8);
|
109 |
color: white;
|
|
|
110 |
font-family: monospace;
|
111 |
}
|
112 |
|
113 |
+
#instructions {
|
114 |
position: fixed;
|
115 |
+
right: 20px;
|
116 |
+
top: 60px;
|
117 |
+
padding: 15px;
|
118 |
background: rgba(0,0,0,0.8);
|
119 |
color: white;
|
120 |
+
border-radius: 5px;
|
121 |
font-family: monospace;
|
122 |
}
|
123 |
|
|
|
167 |
</div>
|
168 |
|
169 |
<script>
|
170 |
+
// 기본 스프라이트 이미지 설정
|
171 |
+
const SPRITE_BASE64 = "data:image/png;base64,<provided_image_base64>";
|
172 |
+
|
173 |
+
const SPRITES = {
|
174 |
+
stand: [
|
175 |
+
SPRITE_BASE64, // kstand1
|
176 |
+
SPRITE_BASE64, // kstand2 - 실제로는 다른 이미지
|
177 |
+
SPRITE_BASE64 // kstand3 - 실제로는 다른 이미지
|
178 |
+
]
|
179 |
+
};
|
180 |
+
|
181 |
+
class Character {
|
182 |
+
constructor(element, isPlayer = true) {
|
183 |
+
this.element = element;
|
184 |
+
this.isPlayer = isPlayer;
|
185 |
+
this.health = 1000;
|
186 |
+
this.pos = { x: isPlayer ? 100 : 650, y: 0 };
|
187 |
+
this.vel = { x: 0, y: 0 };
|
188 |
+
this.direction = isPlayer ? 'right' : 'left';
|
189 |
+
this.isMoving = false;
|
190 |
+
this.isAttacking = false;
|
191 |
+
this.isJumping = false;
|
192 |
+
this.currentFrame = 0;
|
193 |
+
this.lastAnimationUpdate = 0;
|
194 |
+
|
195 |
+
if (isPlayer) {
|
196 |
+
this.element.style.backgroundImage = `url(${SPRITES.stand[0]})`;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
updateAnimation(timestamp) {
|
201 |
+
if (this.isPlayer && !this.isMoving && !this.isAttacking) {
|
202 |
+
if (timestamp - this.lastAnimationUpdate >= 500) {
|
203 |
+
this.currentFrame = (this.currentFrame + 1) % SPRITES.stand.length;
|
204 |
+
this.element.style.backgroundImage =
|
205 |
+
`url(${SPRITES.stand[this.currentFrame]})`;
|
206 |
+
this.lastAnimationUpdate = timestamp;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
// Game 클래스를 계속 구현할까요?
|
213 |
</script>
|
214 |
</body>
|
215 |
</html>
|