core2d 2.10.4 → 2.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/package.json +53 -48
- package/src/ACL.mjs +55 -55
- package/src/Animation.mjs +87 -50
- package/src/Axis.mjs +1 -6
- package/src/ButtonLayout.mjs +36 -36
- package/src/ButtonLayoutMap.mjs +1 -1
- package/src/Color.mjs +148 -148
- package/src/Command.mjs +10 -10
- package/src/CompositeOperations.mjs +11 -11
- package/src/Controller.mjs +85 -50
- package/src/Core2D.mjs +272 -124
- package/src/Direction.mjs +22 -22
- package/src/Engine.mjs +448 -445
- package/src/FontFamily.mjs +5 -5
- package/src/Frame.mjs +40 -16
- package/src/GamePad.mjs +43 -39
- package/src/Input.mjs +114 -111
- package/src/Key.mjs +18 -18
- package/src/KeyMap.mjs +18 -18
- package/src/Keyboard.mjs +28 -28
- package/src/Mouse.mjs +35 -23
- package/src/Point.mjs +64 -28
- package/src/Pointer.mjs +59 -37
- package/src/Rect.mjs +243 -121
- package/src/RenderableList.mjs +12 -12
- package/src/Scene.mjs +141 -100
- package/src/Sound.mjs +134 -130
- package/src/Sprite.mjs +690 -358
- package/src/Static.mjs +54 -54
- package/src/TextSprite.mjs +232 -132
- package/src/Touch.mjs +41 -29
- package/src/Transition.mjs +12 -12
- package/src/plugin/BaseTile.mjs +5 -5
- package/src/plugin/ClickableSprite.mjs +15 -16
- package/src/plugin/ControllableSprite.mjs +37 -31
- package/src/plugin/CursorSprite.mjs +33 -33
- package/src/plugin/Fog.mjs +23 -20
- package/src/plugin/FontSprite.mjs +72 -67
- package/src/plugin/JumperSprite.mjs +132 -133
- package/src/plugin/RandomRectTransition.mjs +22 -23
- package/src/plugin/Starfield.mjs +47 -45
package/src/Static.mjs
CHANGED
|
@@ -3,75 +3,75 @@
|
|
|
3
3
|
import { ACL } from "./ACL.mjs";
|
|
4
4
|
|
|
5
5
|
export class Static {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
static checkCollisions(sprites) {
|
|
7
|
+
const LENGTH = sprites.length;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
for (let i = 0; i < LENGTH - 1; ++i) {
|
|
10
|
+
const LEFT_SPRITE = sprites[i];
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
for (let j = i + 1; j < LENGTH; ++j) {
|
|
13
|
+
const RIGHT_SPRITE = sprites[j];
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
if (LEFT_SPRITE.hasCollision(RIGHT_SPRITE)) {
|
|
16
|
+
LEFT_SPRITE.collided = true;
|
|
17
|
+
LEFT_SPRITE.onCollision(RIGHT_SPRITE);
|
|
18
|
+
RIGHT_SPRITE.collided = true;
|
|
19
|
+
RIGHT_SPRITE.onCollision(LEFT_SPRITE);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
static getElement(id) {
|
|
26
|
+
const element = ACL.document.getElementById(id);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (!element) {
|
|
29
|
+
console.warn(`Could not find element with id: ${id}`);
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
return element;
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
static getElements(name) {
|
|
36
|
+
return Array.from(ACL.document.getElementsByTagName(name));
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
static getGamepads() {
|
|
40
|
+
if (!navigator.getGamepads) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
return navigator.getGamepads();
|
|
45
|
+
}
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
static getImage(image) {
|
|
48
|
+
if ("string" == typeof image) {
|
|
49
|
+
return this.getElement(image);
|
|
50
|
+
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
return image;
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
static makeEnum(array) {
|
|
56
|
+
return this.makeHash(array, true);
|
|
57
|
+
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
static makeHash(array, indexed) {
|
|
60
|
+
const RESULT = {};
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
for (let i = 0; i < array.length; ++i) {
|
|
63
|
+
const VALUE = array[i];
|
|
64
|
+
RESULT[VALUE] = indexed ? i : VALUE;
|
|
65
|
+
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
return RESULT;
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
static toDegrees(radians) {
|
|
71
|
+
return (radians * 180) / Math.PI;
|
|
72
|
+
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
static toRadians(degrees) {
|
|
75
|
+
return (degrees * Math.PI) / 180;
|
|
76
|
+
}
|
|
77
77
|
}
|
package/src/TextSprite.mjs
CHANGED
|
@@ -8,137 +8,237 @@ import { Sprite } from "./Sprite.mjs";
|
|
|
8
8
|
const hiddenCanvas = ACL.document.createElement("canvas");
|
|
9
9
|
const hiddenContext = hiddenCanvas.getContext("2d");
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Represents a text sprite.
|
|
13
|
+
* @extends Sprite
|
|
14
|
+
*/
|
|
11
15
|
export class TextSprite extends Sprite {
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new TextSprite.
|
|
18
|
+
* @param {string} [text=""] The text to display.
|
|
19
|
+
*/
|
|
20
|
+
constructor(text = "") {
|
|
21
|
+
super();
|
|
22
|
+
this._text = text;
|
|
23
|
+
this._fontFamily = FontFamily.Monospace;
|
|
24
|
+
this._fontSize = 16;
|
|
25
|
+
this.fontColor = Color.White;
|
|
26
|
+
this.lineWidth = 0;
|
|
27
|
+
this.shadowBlur = 0;
|
|
28
|
+
this.shadowColor = null;
|
|
29
|
+
this.shadowOffsetX = 0;
|
|
30
|
+
this.shadowOffsetY = 0;
|
|
31
|
+
this.strokeStyle = null;
|
|
32
|
+
this._updateFont();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Renders the text sprite.
|
|
37
|
+
* @param {CanvasRenderingContext2D} context The rendering context.
|
|
38
|
+
*/
|
|
39
|
+
render(context) {
|
|
40
|
+
if (Sprite.prototype.render.call(this, context)) {
|
|
41
|
+
context.fillStyle = this.fontColor;
|
|
42
|
+
context.font = this._font;
|
|
43
|
+
context.textBaseline = "top";
|
|
44
|
+
|
|
45
|
+
if (this.shadowColor) {
|
|
46
|
+
context.shadowColor = this.shadowColor;
|
|
47
|
+
context.shadowOffsetX = this.shadowOffsetX;
|
|
48
|
+
context.shadowOffsetY = this.shadowOffsetY;
|
|
49
|
+
context.shadowBlur = this.shadowBlur;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
context.fillText(
|
|
53
|
+
this._text,
|
|
54
|
+
this.left + this.scene.x,
|
|
55
|
+
this.bottom + this.scene.y,
|
|
56
|
+
this.width
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (this.shadowColor) {
|
|
60
|
+
context.shadowColor = null;
|
|
61
|
+
context.shadowOffsetX = 0;
|
|
62
|
+
context.shadowOffsetY = 0;
|
|
63
|
+
context.shadowBlur = 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.strokeStyle) {
|
|
67
|
+
context.lineWidth = this.lineWidth;
|
|
68
|
+
context.strokeStyle = this.strokeStyle;
|
|
69
|
+
context.strokeText(
|
|
70
|
+
this._text,
|
|
71
|
+
this.left + this.scene.x,
|
|
72
|
+
this.bottom + this.scene.y,
|
|
73
|
+
this.width
|
|
74
|
+
);
|
|
75
|
+
context.lineWidth = 0;
|
|
76
|
+
context.strokeStyle = null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Sets the font color.
|
|
83
|
+
* @param {string} fontColor The font color.
|
|
84
|
+
* @returns {TextSprite} This text sprite.
|
|
85
|
+
*/
|
|
86
|
+
setFontColor(fontColor) {
|
|
87
|
+
this.fontColor = fontColor;
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Sets the font family.
|
|
93
|
+
* @param {string} fontFamily The font family.
|
|
94
|
+
* @returns {TextSprite} This text sprite.
|
|
95
|
+
*/
|
|
96
|
+
setFontFamily(fontFamily) {
|
|
97
|
+
this._fontFamily = fontFamily;
|
|
98
|
+
this._updateFont();
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Sets the font size.
|
|
104
|
+
* @param {number} fontSize The font size.
|
|
105
|
+
* @returns {TextSprite} This text sprite.
|
|
106
|
+
*/
|
|
107
|
+
setFontSize(fontSize) {
|
|
108
|
+
this._fontSize = fontSize;
|
|
109
|
+
this.height = fontSize;
|
|
110
|
+
this._updateFont();
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Sets the line width.
|
|
116
|
+
* @param {number} lineWidth The line width.
|
|
117
|
+
* @returns {TextSprite} This text sprite.
|
|
118
|
+
*/
|
|
119
|
+
setLineWidth(lineWidth) {
|
|
120
|
+
this.lineWidth = lineWidth;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Sets the shadow blur.
|
|
126
|
+
* @param {number} shadowBlur The shadow blur.
|
|
127
|
+
* @returns {TextSprite} This text sprite.
|
|
128
|
+
*/
|
|
129
|
+
setShadowBlur(shadowBlur) {
|
|
130
|
+
this.shadowBlur = shadowBlur;
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Sets the shadow color.
|
|
136
|
+
* @param {string} shadowColor The shadow color.
|
|
137
|
+
* @returns {TextSprite} This text sprite.
|
|
138
|
+
*/
|
|
139
|
+
setShadowColor(shadowColor) {
|
|
140
|
+
this.shadowColor = shadowColor;
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Sets the shadow offset x.
|
|
146
|
+
* @param {number} shadowOffsetX The shadow offset x.
|
|
147
|
+
* @returns {TextSprite} This text sprite.
|
|
148
|
+
*/
|
|
149
|
+
setShadowOffsetX(shadowOffsetX) {
|
|
150
|
+
this.shadowOffsetX = shadowOffsetX;
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Sets the shadow offset y.
|
|
156
|
+
* @param {number} shadowOffsetY The shadow offset y.
|
|
157
|
+
* @returns {TextSprite} This text sprite.
|
|
158
|
+
*/
|
|
159
|
+
setShadowOffsetY(shadowOffsetY) {
|
|
160
|
+
this.shadowOffsetY = shadowOffsetY;
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Sets the stroke style.
|
|
166
|
+
* @param {string} strokeStyle The stroke style.
|
|
167
|
+
* @returns {TextSprite} This text sprite.
|
|
168
|
+
*/
|
|
169
|
+
setStrokeStyle(strokeStyle) {
|
|
170
|
+
this.strokeStyle = strokeStyle;
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Sets the text.
|
|
176
|
+
* @param {string} text The text.
|
|
177
|
+
* @returns {TextSprite} This text sprite.
|
|
178
|
+
*/
|
|
179
|
+
setText(text) {
|
|
180
|
+
this._text = text;
|
|
181
|
+
this._updateFont();
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The font family.
|
|
187
|
+
* @type {string}
|
|
188
|
+
*/
|
|
189
|
+
get fontFamily() {
|
|
190
|
+
return this._fontFamily;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The font size.
|
|
195
|
+
* @type {number}
|
|
196
|
+
*/
|
|
197
|
+
get fontSize() {
|
|
198
|
+
return this._fontSize;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The text.
|
|
203
|
+
* @type {string}
|
|
204
|
+
*/
|
|
205
|
+
get text() {
|
|
206
|
+
return this._text;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The font family.
|
|
211
|
+
* @type {string}
|
|
212
|
+
*/
|
|
213
|
+
set fontFamily(fontFamily) {
|
|
214
|
+
this.setFontFamily(fontFamily);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* The font size.
|
|
219
|
+
* @type {number}
|
|
220
|
+
*/
|
|
221
|
+
set fontSize(fontSize) {
|
|
222
|
+
this.setFontSize(fontSize);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The text.
|
|
227
|
+
* @type {string}
|
|
228
|
+
*/
|
|
229
|
+
set text(text) {
|
|
230
|
+
this.setText(text);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Updates the font.
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
_updateFont() {
|
|
238
|
+
this._font = `${this._fontSize}px ${this._fontFamily}`;
|
|
239
|
+
hiddenContext.textBaseline = "top";
|
|
240
|
+
hiddenContext.font = this._font;
|
|
241
|
+
const measurement = hiddenContext.measureText(this._text);
|
|
242
|
+
this.width = measurement.width;
|
|
243
|
+
}
|
|
144
244
|
}
|
package/src/Touch.mjs
CHANGED
|
@@ -3,38 +3,50 @@
|
|
|
3
3
|
import { Point } from "./Point.mjs";
|
|
4
4
|
|
|
5
5
|
export class Touch extends Point {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
constructor(event) {
|
|
7
|
+
super();
|
|
8
|
+
event.preventDefault();
|
|
9
|
+
this._isDown = true;
|
|
10
|
+
this.updateCoordinates(event);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
addEventListener(
|
|
13
|
+
"touchend",
|
|
14
|
+
(event) => {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
this._isDown = false;
|
|
17
|
+
this.updateCoordinates(event);
|
|
18
|
+
},
|
|
19
|
+
false
|
|
20
|
+
);
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
addEventListener(
|
|
23
|
+
"touchmove",
|
|
24
|
+
(event) => {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
this.updateCoordinates(event);
|
|
27
|
+
},
|
|
28
|
+
false
|
|
29
|
+
);
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
addEventListener(
|
|
32
|
+
"touchstart",
|
|
33
|
+
() => {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
this._isDown = true;
|
|
36
|
+
this.updateCoordinates(event);
|
|
37
|
+
},
|
|
38
|
+
false
|
|
39
|
+
);
|
|
40
|
+
}
|
|
29
41
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
get command() {
|
|
43
|
+
return this._isDown;
|
|
44
|
+
}
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
updateCoordinates(event) {
|
|
47
|
+
const TOUCHES = event.changedTouches;
|
|
48
|
+
const TOUCH = TOUCHES[0];
|
|
49
|
+
this.x = TOUCH.pageX;
|
|
50
|
+
this.y = TOUCH.pageY;
|
|
51
|
+
}
|
|
40
52
|
}
|
package/src/Transition.mjs
CHANGED
|
@@ -4,18 +4,18 @@ import { Color } from "./Color.mjs";
|
|
|
4
4
|
import { Sprite } from "./Sprite.mjs";
|
|
5
5
|
|
|
6
6
|
export class Transition extends Sprite {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
init() {
|
|
8
|
+
this.setColor(Color.Black);
|
|
9
|
+
this.setHeight(this.scene.height);
|
|
10
|
+
this._increase = this.scene.width / 32;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
sync() {
|
|
14
|
+
if (this.width > this.scene.width) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
this.width += this._increase;
|
|
19
|
+
return Sprite.prototype.sync.call(this);
|
|
20
|
+
}
|
|
21
21
|
}
|
package/src/plugin/BaseTile.mjs
CHANGED
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import { Sprite } from "../Sprite.mjs";
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export class ClickableSprite extends Sprite {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.addTag("clickable");
|
|
9
|
+
this.setSolid();
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
onClick() {
|
|
13
|
+
// no default behavior
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
onHoverIn() {
|
|
17
|
+
// no default behavior
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
onHoverOut() {
|
|
21
|
+
// no default behavior
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
|
-
|