Skip to content

Commit

Permalink
move the backrooms exit to another place + add exit animation thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
meszaros-lajos-gyorgy committed May 23, 2024
1 parent e621909 commit 630fd27
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 87 deletions.
20 changes: 4 additions & 16 deletions assets/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,17 @@
"english": "A little metal key with signs of wear",
"german": "Ein kleiner Metallschlüssel mit Gebrauchsspuren"
},
"backrooms-door-label-normal": {
"english": "Fire Exit",
"german": "Notausgang"
},
"backrooms-door-label-glitch1": {
"english": "Fire 3xit",
"german": "N0tausgang"
},
"backrooms-door-label-glitch2": {
"english": "F1re Exit",
"german": "Notau5gang"
},
"backrooms-door-label-glitch3": {
"english": "Fire Ex!t",
"german": "Notausgan9"
"door--backrooms-exit": {
"english": "Fire Safety Door - Do not obstruct, do not keep open!",
"german": "Notausgangstür - frei halten, nicht offen halten!"
},
"trash-bag": {
"english": "A smelly bag of trash",
"german": "Ein stinkender Müllsack"
},
"wet-floor-sign": {
"english": "Wet floor sign",
"german": "Nassbodenschild"
"german": "vorsicht rutschgefahr schild"
},
"tutorial--backrooms-1": {
"english": "Uh oh, you went out of bounds and landed in the backrooms. Find an unmarked fire exit door to return to the map.",
Expand Down
4 changes: 2 additions & 2 deletions assets/lalees-minigame.rooms
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ room add 200 300 50 backrooms-a y- z++ x-
room add 500 300 500 backrooms-b y- z++
cursor save backrooms-room-09
room add 800 300 200 backrooms-a y- x--
room add 250 300 150 backrooms-a y- x- z--
room add 250 300 150 backrooms-a y- x- z++
with light 20%
cursor save backrooms-exit
room add 150 200 1000 backrooms-b z--
room add 150 200 1000 backrooms-b z++

cursor restore office-corridor
room add 200 300 50 backrooms-a y- z++ x+
Expand Down
19 changes: 16 additions & 3 deletions src/gameStateManager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Audio, Entity, Settings } from 'arx-level-generator'
import { Audio, Color, Entity, Settings } from 'arx-level-generator'
import { ScriptSubroutine } from 'arx-level-generator/scripting'
import { Sound, SoundFlags } from 'arx-level-generator/scripting/classes'
import { useDelay } from 'arx-level-generator/scripting/hooks'
import { Variable } from 'arx-level-generator/scripting/properties'
import { PlayerControls, Variable } from 'arx-level-generator/scripting/properties'

const notification = new Sound(Audio.system.filename, SoundFlags.EmitFromPlayer)
const achievement = new Sound(Audio.system3.filename, SoundFlags.EmitFromPlayer)
Expand Down Expand Up @@ -169,6 +169,13 @@ export const createGameStateManager = (settings: Settings) => {
`
}

const demonAudio = new Audio({
filename: 'demon_breath3',
isNative: true,
type: 'sfx',
})
const demonSound = new Sound(demonAudio.filename, SoundFlags.EmitFromPlayer)

manager.script
?.on('game_collected', () => {
const { delay } = useDelay()
Expand Down Expand Up @@ -222,7 +229,13 @@ export const createGameStateManager = (settings: Settings) => {
.on('entered_at_the_main_hall_zone', killGoblin)
.on('entered_at_the_entrance_zone', killGoblin)
.on('player_leaves_backrooms', () => {
return `sendevent send_to_spawn player nop`
const { delay } = useDelay()
return `
${PlayerControls.off}
worldfade out 500 ${Color.fromCSS('black').toScriptColor()}
${delay(1000)} ${demonSound.play()}
${delay(3000)} sendevent send_to_spawn player nop worldfade in 500 ${PlayerControls.on}
`
})
.on('landed_in_backrooms', () => {
return `
Expand Down
70 changes: 4 additions & 66 deletions src/rooms/backrooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const createBackrooms = async (
const exitZone = createZone({
position: exitCursor.origin
.clone()
.add(new Vector3(0, 0, -300))
.add(new Vector3(0, 0, 300))
.multiply(new Vector3(1, -1, 1))
.add(new Vector3(0, 50, 0)),
size: new Vector3(150, 50, 100),
Expand All @@ -134,74 +134,12 @@ export const createBackrooms = async (

// TODO: add custom texture to this door
const fireExitDoor = new CatacombHeavyDoor({
position: exitCursor.origin.clone().add(new Vector3(-75, 0, -exitCursor.size.z / 2 + 10)),
orientation: new Rotation(0, MathUtils.degToRad(90), 0),
position: exitCursor.origin.clone().add(new Vector3(75, 0, exitCursor.size.z / 2 - 10)),
orientation: new Rotation(0, MathUtils.degToRad(-90), 0),
isLocked: true,
})
fireExitDoor.setKey(exitKey)

const normalLabel = new Label('[backrooms-door-label-normal]')
const glitchLabel1 = new Label('[backrooms-door-label-glitch1]')
const glitchLabel2 = new Label('[backrooms-door-label-glitch2]')
const glitchLabel3 = new Label('[backrooms-door-label-glitch3]')

const labelGlitcher = new ScriptSubroutine(
'label_glitcher',
() => {
const { delay: delay1 } = useDelay()
const { delay: delay2 } = useDelay()

return `
random 50 {
${delay1(0)} ${glitchLabel1}
${delay1(randomIntBetween(50, 80))} ${normalLabel}
${delay1(randomIntBetween(50, 80))} ${glitchLabel2}
random 50 {
${delay1(randomIntBetween(50, 80))} ${glitchLabel3}
}
${delay1(randomIntBetween(200, 300))} ${normalLabel}
} else {
${delay2(0)} ${glitchLabel3}
${delay2(randomIntBetween(50, 80))} ${normalLabel}
${delay2(randomIntBetween(50, 80))} ${glitchLabel1}
random 50 {
${delay2(randomIntBetween(50, 80))} ${glitchLabel2}
}
${delay2(randomIntBetween(200, 300))} ${normalLabel}
}
random 50 {
${delay1(randomIntBetween(500, 750))} ${glitchLabel1}
${delay1(randomIntBetween(50, 80))} ${normalLabel}
${delay1(randomIntBetween(50, 80))} ${glitchLabel3}
random 50 {
${delay1(randomIntBetween(50, 80))} ${glitchLabel2}
}
${delay1(randomIntBetween(200, 300))} ${normalLabel}
} else {
${delay2(randomIntBetween(500, 750))} ${glitchLabel2}
${delay2(randomIntBetween(50, 80))} ${normalLabel}
${delay2(randomIntBetween(50, 80))} ${glitchLabel1}
random 50 {
${delay2(randomIntBetween(50, 80))} ${glitchLabel3}
}
${delay2(randomIntBetween(200, 300))} ${normalLabel}
}
`
},
'goto',
)
fireExitDoor.script?.subroutines.push(labelGlitcher)

fireExitDoor.script?.properties.push(normalLabel)
fireExitDoor.script?.on('init', () => {
const { loop } = useDelay()

return `
${loop(2500, Infinity)} ${labelGlitcher.invoke()}
`
})

fireExitDoor.script?.properties.push(new Label('[door--backrooms-exit]'))
contents.entities.push(fireExitDoor, exitKey)
}

Expand Down

0 comments on commit 630fd27

Please sign in to comment.