File tree Expand file tree Collapse file tree 7 files changed +6
-4
lines changed Expand file tree Collapse file tree 7 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 135
135
< button class ="start "> Start</ button >
136
136
</ div >
137
137
</ div >
138
+ < audio src ="hit.wav " id ="hit-audio "> </ audio >
139
+ < audio src ="hurt.wav " id ="hurt-audio "> </ audio >
140
+ < audio src ="powerup.wav " id ="powerup-audio "> </ audio >
138
141
< script type ="module " src ="/src/main.ts "> </ script >
139
142
</ body >
140
143
</ html >
Original file line number Diff line number Diff line change @@ -27,9 +27,6 @@ export class DeathRenderComponent extends BaseComponent implements Renderer {
27
27
28
28
start ( ) {
29
29
this . transform = COMPONENTS [ this . entity ] [ "transform" ] ;
30
- if ( ! this . transform ) {
31
- console . error ( `no transform component on ${ this . entity } ` ) ;
32
- }
33
30
}
34
31
35
32
render ( ctx : CanvasRenderingContext2D ) {
@@ -147,6 +144,7 @@ export class PlayerCollider extends Collider implements ICollider {
147
144
COMPONENTS . player . collider ! . collidingWith . delete ( e ) ;
148
145
delete COMPONENTS [ e ] ;
149
146
GAME . score += 1 ;
147
+ ( document . querySelector ( "#hit-audio" ) as HTMLAudioElement ) . play ( ) ;
150
148
151
149
if (
152
150
Object . keys ( COMPONENTS ) . filter ( ( x ) => x . startsWith ( "npc" ) )
@@ -158,6 +156,7 @@ export class PlayerCollider extends Collider implements ICollider {
158
156
159
157
if ( ! npcLife . living && this . enabled ) {
160
158
this . playerHealth ! . hearts -= 1 ;
159
+ ( document . querySelector ( "#hurt-audio" ) as HTMLAudioElement ) . play ( ) ;
161
160
if ( this . playerHealth ! . hearts === 0 ) {
162
161
this . enabled = false ;
163
162
GAME . screen = "uded" ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export class DoorCollider extends Collider implements ICollider {
11
11
for ( const e of entities ) {
12
12
if ( e === "player" ) {
13
13
GAME . level += 1 ;
14
+ ( document . querySelector ( "#powerup-audio" ) as HTMLAudioElement ) . play ( ) ;
14
15
}
15
16
}
16
17
}
Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ class Game {
123
123
124
124
countdown ( deltaTime : number ) {
125
125
if ( this . screen !== "game" ) return ;
126
- console . log ( "hello?" ) ;
127
126
if ( this . waitingForStart === 0 ) return ;
128
127
129
128
ctx . fillStyle = "white" ;
You can’t perform that action at this time.
0 commit comments