diff --git a/src/js/Screens.js b/src/js/Screens.js index db7b23d..ecda86c 100644 --- a/src/js/Screens.js +++ b/src/js/Screens.js @@ -427,7 +427,7 @@ class BlinkViewer { this.hideMenu() CURRENTGAMESTATE = 'PLAYING'; let text = "The trees, gnarled and black against the dying light, seemed to reach for you with skeletal fingers. The wind, a mournful sigh through the pines, whispered of things long dead and best forgotten. You stood there, at the foot of the mansion, your breath coming in ragged gasps, the taste of fear metallic on your tongue. The crash, the figure on the road, it was all a kaleidoscope of terror in your mind. Now, this house, looming like a tombstone against the bruised sky, offered sanctuary. Or did it? A flicker of movement in a shattered window, a shadow playing tricks? Or was it the figure, somehow transported, already inside, waiting for you? You knew the car was useless, a mangled wreck offering no escape. But the woods, with their rustling secrets and unseen eyes, were no haven either. The mansion, for all its haunted stillness, was your only option. Taking a shuddering breath, you stepped forward, each footfall echoing in the unnatural hush. The door, ancient and weathered, creaked open as if it had been waiting for you, beckoning you into the darkness. The smell hit you first, a mix of dust and decay, a hint of something sickly sweet underneath. And then the cold, seeping into your bones, a chill that went deeper than the autumn air. You were trapped, caught in a game you didn't understand, the rules whispered by unseen entities. Escape. That was the only goal. Escape the mansion, escape the figure, escape the darkness that seemed to crawl beneath your skin. But how? The answer, like everything else in this place, was shrouded in shadows."; - textBox(text, 25, "70vw", "20vh", false) + textBox(text, 25, "600px", "200px", false) setTimeout(() =>{ textBox("You have a flashlight that you brought from your car, to view it press e.") }, 70000); diff --git a/src/js/playing.js b/src/js/playing.js index fcc6d6d..47db9a0 100644 --- a/src/js/playing.js +++ b/src/js/playing.js @@ -1,4 +1,20 @@ +let HAS_DIED=false; function playingFunctionality(){ + if(player.health <= 0) { + if(HAS_DIED){ + return; + } + playerMovement.target.velocity.x=0; + playerMovement.target.velocity.y=0; + player.changeAni('idle_down'); + HAS_DIED=true; + textBox("You died. Try again.") + healthBar.img = deadHealth; + setTimeout(() => { + window.location.reload(); + }, 3500); + return; + } if (player.health <= 0) { healthBar.img = null; } @@ -47,13 +63,7 @@ function playingFunctionality(){ else GAMESTATE = "WON"; } - if(player.health <= 0) { - textBox("You died. Try again.") - healthBar.img = deadHealth; - setTimeout(() => { - window.location.reload(); - }, 3500); - } + if(inventory.hasItem(flashlight)){ darknessDraw(player.x, player.y, player.velocity.x, player.velocity.y, true); diff --git a/tests/selenium/seleniumTests.py b/tests/selenium/seleniumTests.py index f7914f1..14be35e 100644 --- a/tests/selenium/seleniumTests.py +++ b/tests/selenium/seleniumTests.py @@ -153,11 +153,7 @@ def test_death(): browser.execute_script('player.health -= 50') browser.execute_script('player.health -= 50') browser.execute_script('player.health -= 50') - time.sleep(4) - alert = browser.switch_to.alert - alert_text = alert.text - assert "died" in alert_text, "Expected alert didn't appear" - alert.dismiss() + time.sleep(6) gamestate = browser.execute_script('return GAMESTATE') print(gamestate) assert gamestate != "PLAYING", "Game state did not change"