Skip to content

Commit

Permalink
Merge pull request #128 from Cars-n/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Cars-n authored May 8, 2024
2 parents 988d6ff + 6135c06 commit b777583
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/js/Screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 17 additions & 7 deletions src/js/playing.js
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions tests/selenium/seleniumTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b777583

Please sign in to comment.