BlueGit

blue-star speeltuin

framework update

timfa Tim · pushed by timfa

Authored 2022-10-19 · 4 years ago

Hash
2e0a4fb14fbb8e824010533d6bb20e35c93a840c
Parent
0b47e9e9
1 file changed +13 −1
build/framework.js +13 −1
@@ -421,6 +421,8 @@ class Renderer
421 421 mirrorX = false;
422 422 mirrorY = false;
423 423
424 defaultAnimationSpeed = 1;
425
424 426 cycle = null;
425 427
426 428 visible = true;
@@ -531,13 +533,18 @@ class Renderer
531 533 );
532 534 }
533 535
534 get currentAnimation()
536 get currentAnimationName()
535 537 {
536 538 return this.cycle? this.cycle.label : null;
537 539 }
538 540
539 541 setAnimation(label, defaultIndex = 0, cycleSpeed = -1)
540 542 {
543 if(cycleSpeed < 0)
544 {
545 cycleSpeed = this.defaultAnimationSpeed;
546 }
547
541 548 if(this.cycle)
542 549 {
543 550 if(this.cycle.label == label)
@@ -878,6 +885,11 @@ Math.clamp = function(number, min, max)
878 885 return Math.min(max, Math.max(min, number));
879 886 }
880 887
888 Math.randomRange = function(min, max)
889 {
890 return min + (Math.random() * (max - min));
891 }
892
881 893 Array.prototype.random = function ()
882 894 {
883 895 return this[Math.floor((Math.random()*this.length))];
@@ -421,6 +421,8 @@ class Renderer
421 mirrorX = false;
421 mirrorX = false;
422 mirrorY = false;
422 mirrorY = false;
423
423
424 defaultAnimationSpeed = 1;
425
424 cycle = null;
426 cycle = null;
425
427
426 visible = true;
428 visible = true;
@@ -531,13 +533,18 @@ class Renderer
531 );
533 );
532 }
534 }
533
535
534 get currentAnimation()
536 get currentAnimationName()
535 {
537 {
536 return this.cycle? this.cycle.label : null;
538 return this.cycle? this.cycle.label : null;
537 }
539 }
538
540
539 setAnimation(label, defaultIndex = 0, cycleSpeed = -1)
541 setAnimation(label, defaultIndex = 0, cycleSpeed = -1)
540 {
542 {
543 if(cycleSpeed < 0)
544 {
545 cycleSpeed = this.defaultAnimationSpeed;
546 }
547
541 if(this.cycle)
548 if(this.cycle)
542 {
549 {
543 if(this.cycle.label == label)
550 if(this.cycle.label == label)
@@ -878,6 +885,11 @@ Math.clamp = function(number, min, max)
878 return Math.min(max, Math.max(min, number));
885 return Math.min(max, Math.max(min, number));
879}
886}
880
887
888Math.randomRange = function(min, max)
889{
890 return min + (Math.random() * (max - min));
891}
892
881Array.prototype.random = function ()
893Array.prototype.random = function ()
882{
894{
883 return this[Math.floor((Math.random()*this.length))];
895 return this[Math.floor((Math.random()*this.length))];