11import { Scene } from 'phaser' ;
2- import { globalConsts } from '../main.ts' ;
2+ import { getRandomInt , globalConsts } from '../main.ts' ;
33import { getRandomObstacleType , obstaclePropertiesMap , obstacleType , ThatObstacle } from './ThatObstacle.ts' ;
44
55// Position type
@@ -29,10 +29,10 @@ export class ThatSection {
2929 // Constructor
3030 constructor ( currentScene : Scene , pause : boolean , offset : number = 2 ) {
3131 this . scene = currentScene ;
32- this . randomVoidOut = globalConsts . getRandomInt ( this . minVoidout , this . maxVoidout ) ;
32+ this . randomVoidOut = getRandomInt ( this . minVoidout , this . maxVoidout ) ;
3333
3434 // Gift generation
35- if ( globalConsts . getRandomInt ( 0 , this . giftProbability ) == 1 ) {
35+ if ( getRandomInt ( 0 , this . giftProbability ) == 1 ) {
3636 const gift = this . generateObstacle ( offset - 1 , obstacleType . GIFT ) ;
3737 this . gift = gift ;
3838 this . obstacles . push ( gift ) ;
@@ -46,7 +46,7 @@ export class ThatSection {
4646 ) ;
4747 // This lines controls if the next should be a break
4848 this . marker . sprite . setAlpha (
49- ! pause ? ( globalConsts . getRandomInt ( 0 , this . breakProbability ) == 0 ? 0 : 1 ) : 1
49+ ! pause ? ( getRandomInt ( 0 , this . breakProbability ) == 0 ? 0 : 1 ) : 1
5050 ) ;
5151 this . marker . sprite . setVisible ( false ) ;
5252 this . obstacles . push ( this . marker ) ;
@@ -56,8 +56,8 @@ export class ThatSection {
5656 for ( let i = 0 ; i < this . amountObstacle ; i ++ ) {
5757 this . obstacles . push ( this . generateObstacle ( offset - 1 ) ) ;
5858 }
59- } else {
60- this . obstacles . push ( new ThatObstacle ( obstacleType . BREAK , this . scene , 30 + globalConsts . gameWidth * ( offset - 1 ) ) )
59+ } else {
60+ this . obstacles . push ( new ThatObstacle ( obstacleType . BREAK , this . scene , 30 + globalConsts . gameWidth * ( offset - 1 ) ) )
6161 }
6262
6363 // Debug
@@ -83,7 +83,7 @@ export class ThatSection {
8383 let tries : number = 0 ;
8484 while ( true ) {
8585 currentPos = {
86- x : globalConsts . getRandomInt ( globalConsts . gameWidth * 0.1 , globalConsts . gameWidth * 0.9 ) + offset * globalConsts . gameWidth ,
86+ x : getRandomInt ( globalConsts . gameWidth * 0.1 , globalConsts . gameWidth * 0.9 ) + offset * globalConsts . gameWidth ,
8787 y : property . y ( )
8888 } ;
8989 let valid : boolean = true ;
0 commit comments