BlueGit

blue-star speeltuin

fw

timfa Tim · pushed by timfa

Authored 2022-10-20 · 4 years ago

Hash
a897e53558c2c17eb0c1f419269774d6bd93e26d
Parent
9ab4f389
1 file changed +15 −3
build/framework.js +15 −3
@@ -200,6 +200,9 @@ class image
200 200 this.loop = loop;
201 201 this.chain = chain;
202 202
203 this.cacheWidth = -1;
204 this.cacheHeight = -1;
205
203 206 image.id = "loadedImage";
204 207 document.body.append(image);
205 208 console.log("Image loaded: " + image.src);
@@ -256,14 +259,23 @@ class image
256 259
257 260 get width ()
258 261 {
259 return this.g_image.width / this.subImagesPerRow;
262 if (this.cacheWidth < 0)
263 this.cacheWidth = this.g_image.width / this.subImagesPerRow;
264
265 return this.cacheWidth;
260 266 }
261 267
262 268 get height ()
263 269 {
264 return this.g_image.height / (Math.ceil(this.subImages / this.subImagesPerRow) + 0);
270 if (this.cacheHeight < 0)
271 this.cacheHeight = this.g_image.height / (Math.ceil(this.subImages / this.subImagesPerRow) + 0);
272
273 return this.cacheHeight;
265 274 }
266 275
276 cacheWidth = -1;
277 cacheHeight = -1;
278
267 279 getSubImage (subImageIndex)
268 280 {
269 281 var subImage = Math.round(subImageIndex);
@@ -377,7 +389,7 @@ class Collider
377 389
378 390 if (this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].collider.enabled)
379 391 {
380 if (this.widestDiagonal + this.gameObject.scene.activeObjects[i].collider.widestDiagonal > this.gameObject.transform.position.distanceTo(this.gameObject.scene.activeObjects[i].transform.position))
392 if (this.widestDiagonal + this.gameObject.scene.activeObjects[i].collider.widestDiagonal < this.gameObject.transform.position.distanceTo(this.gameObject.scene.activeObjects[i].transform.position))
381 393 continue;
382 394
383 395 var hit = false;
@@ -200,6 +200,9 @@ class image
200 this.loop = loop;
200 this.loop = loop;
201 this.chain = chain;
201 this.chain = chain;
202
202
203 this.cacheWidth = -1;
204 this.cacheHeight = -1;
205
203 image.id = "loadedImage";
206 image.id = "loadedImage";
204 document.body.append(image);
207 document.body.append(image);
205 console.log("Image loaded: " + image.src);
208 console.log("Image loaded: " + image.src);
@@ -256,14 +259,23 @@ class image
256
259
257 get width ()
260 get width ()
258 {
261 {
259 return this.g_image.width / this.subImagesPerRow;
262 if (this.cacheWidth < 0)
263 this.cacheWidth = this.g_image.width / this.subImagesPerRow;
264
265 return this.cacheWidth;
260 }
266 }
261
267
262 get height ()
268 get height ()
263 {
269 {
264 return this.g_image.height / (Math.ceil(this.subImages / this.subImagesPerRow) + 0);
270 if (this.cacheHeight < 0)
271 this.cacheHeight = this.g_image.height / (Math.ceil(this.subImages / this.subImagesPerRow) + 0);
272
273 return this.cacheHeight;
265 }
274 }
266
275
276 cacheWidth = -1;
277 cacheHeight = -1;
278
267 getSubImage (subImageIndex)
279 getSubImage (subImageIndex)
268 {
280 {
269 var subImage = Math.round(subImageIndex);
281 var subImage = Math.round(subImageIndex);
@@ -377,7 +389,7 @@ class Collider
377
389
378 if (this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].collider.enabled)
390 if (this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].collider.enabled)
379 {
391 {
380 if (this.widestDiagonal + this.gameObject.scene.activeObjects[i].collider.widestDiagonal > this.gameObject.transform.position.distanceTo(this.gameObject.scene.activeObjects[i].transform.position))
392 if (this.widestDiagonal + this.gameObject.scene.activeObjects[i].collider.widestDiagonal < this.gameObject.transform.position.distanceTo(this.gameObject.scene.activeObjects[i].transform.position))
381 continue;
393 continue;
382
394
383 var hit = false;
395 var hit = false;