-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntity.js
More file actions
33 lines (31 loc) · 726 Bytes
/
Entity.js
File metadata and controls
33 lines (31 loc) · 726 Bytes
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
/**
* Base Entity class for all game objects
* @class Entity
*/
export class Entity {
/**
* Creates an instance of Entity
* @param {number} x - X coordinate
* @param {number} y - Y coordinate
* @param {number} w - Width
* @param {number} h - Height
*/
constructor(x, y, w, h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.dead = false;
}
/**
* Update entity state
* @param {number} dt - Delta time
* @param {Object} game - Game instance
*/
update(dt, game) { }
/**
* Draw entity on canvas
* @param {CanvasRenderingContext2D} ctx - Canvas context
*/
draw(ctx) { }
}