Skip to content

Commit 985b428

Browse files
committed
fix: merge conflicts
I messed up the merge conflicts
1 parent 703fbff commit 985b428

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

src/game/main.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import {Credits} from './scenes/Credits.ts';
88
import {Controls} from './scenes/Controls.ts';
99
import {ThatGame} from './thatFolder/ThatGame.ts';
1010
import {Leaderboard} from './scenes/Leaderboard.ts';
11+
import {get3} from "./thatFolder/ThatPlayer.ts";
1112
import Gamepad = Phaser.Input.Gamepad.Gamepad;
12-
import { get3 } from "./thatFolder/ThatPlayer.ts";
13+
import Image = Phaser.GameObjects.Image;
1314

1415
// Config
1516
const gameW: number = 1024;
@@ -32,7 +33,6 @@ export const globalConsts = {
3233
debug: debugMode,
3334
pixelFont: pixelFontName,
3435
apiURL: api,
35-
getRandomInt: getRandomInt,
3636
backgroundSpeed: speed,
3737
houseSpeed: speed,
3838
spriteSpeed: speed,
@@ -102,10 +102,11 @@ export function escapeOption(that: Scene, gamepad?: Gamepad): void {
102102
return;
103103
}
104104
}
105+
}
105106

106107

107108
// Get random Int between to points
108-
function getRandomInt(min: number, max: number): number {
109+
export function getRandomInt(min: number, max: number): number {
109110
const minCeiled: number = Math.ceil(min);
110111
const maxFloored: number = Math.floor(max);
111112
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled)

src/game/thatFolder/ThatObstacle.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Scene} from "phaser";
2-
import {globalConsts} from '../main.ts';
2+
import {getRandomInt, globalConsts} from '../main.ts';
33

44
// Every obstacle
55
export enum obstacleType {
@@ -9,7 +9,7 @@ export enum obstacleType {
99
ROCKS = "ROCKS",
1010
MARKER = "MARKER",
1111
GIFT = "GIFT",
12-
BREAK ="BREAK",
12+
BREAK = "BREAK",
1313
}
1414

1515
// Every obstacle that can be randomly generated
@@ -35,7 +35,7 @@ interface obstacleProperties {
3535
// Settings for every obstacle
3636
export const obstaclePropertiesMap: Record<obstacleType, obstacleProperties> = {
3737
[obstacleType.BIRDBLUE]: {
38-
y: () => globalConsts.getRandomInt(globalConsts.gameHeight * 0.4, globalConsts.gameHeight * 0.8),
38+
y: () => getRandomInt(globalConsts.gameHeight * 0.4, globalConsts.gameHeight * 0.8),
3939
sprites: ["birdBlue"],
4040
width: 16,
4141
height: 6,
@@ -45,7 +45,7 @@ export const obstaclePropertiesMap: Record<obstacleType, obstacleProperties> = {
4545
weight: 100
4646
},
4747
[obstacleType.BIRDPINK]: {
48-
y: () => globalConsts.getRandomInt(globalConsts.gameHeight * 0.4, globalConsts.gameHeight * 0.8),
48+
y: () => getRandomInt(globalConsts.gameHeight * 0.4, globalConsts.gameHeight * 0.8),
4949
sprites: ["birdPink"],
5050
width: 16,
5151
height: 6,
@@ -85,7 +85,7 @@ export const obstaclePropertiesMap: Record<obstacleType, obstacleProperties> = {
8585
weight: 0
8686
},
8787
[obstacleType.GIFT]: {
88-
y: () => globalConsts.getRandomInt(globalConsts.gameHeight * 0.6, globalConsts.gameHeight * 0.8),
88+
y: () => getRandomInt(globalConsts.gameHeight * 0.6, globalConsts.gameHeight * 0.8),
8989
sprites: ["gift1", "gift2", "gift3", "gift4"],
9090
width: 18,
9191
height: 18,
@@ -94,15 +94,16 @@ export const obstaclePropertiesMap: Record<obstacleType, obstacleProperties> = {
9494
scale: 2,
9595
weight: 0
9696
},
97-
[obstacleType.BREAK]: {
98-
y: () => globalConsts.gameHeight - 90,
97+
[obstacleType.BREAK]: {
98+
y: () => globalConsts.gameHeight - 90,
9999
sprites: ["sign"],
100100
width: 164,
101101
height: 100,
102102
offsetX: 90,
103103
offsetY: 70,
104104
scale: 6,
105-
weight: 100}
105+
weight: 100
106+
}
106107
};
107108

108109
// Gets random type

src/game/thatFolder/ThatSection.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Scene} from 'phaser';
2-
import {globalConsts} from '../main.ts';
2+
import {getRandomInt, globalConsts} from '../main.ts';
33
import {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

Comments
 (0)