-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayArea.js
More file actions
38 lines (34 loc) · 841 Bytes
/
playArea.js
File metadata and controls
38 lines (34 loc) · 841 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
34
35
36
37
38
class PlayArea {
constructor() {
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
// Remove grass color, grass details, and pebbles arrays
}
setBounds(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
// Check if a point is within the play area
contains(x, y) {
return (x > this.x && x < this.x + this.width &&
y > this.y && y < this.y + this.height);
}
// Get play area dimensions - useful for pet movement constraints
getDimensions() {
return {
x: this.x,
y: this.y,
width: this.width,
height: this.height
};
}
// Update appearance on window resize
resize(x, y, width, height) {
this.setBounds(x, y, width, height);
// No need to regenerate visual elements
}
}