Skip to content

Local Storage working again #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/Snake-Graphics/apple.webp
Binary file not shown.
Binary file added images/Snake-Graphics/curve down - right.webp
Binary file not shown.
Binary file added images/Snake-Graphics/curve down left.webp
Binary file not shown.
Binary file added images/Snake-Graphics/curve right - up.webp
Binary file not shown.
Binary file added images/Snake-Graphics/curve top - left.webp
Binary file not shown.
Binary file added images/Snake-Graphics/head down.webp
Binary file not shown.
Binary file added images/Snake-Graphics/head left.webp
Binary file not shown.
Binary file added images/Snake-Graphics/head right.webp
Binary file not shown.
Binary file added images/Snake-Graphics/head up.webp
Binary file not shown.
Binary file added images/Snake-Graphics/straight horizontal.webp
Binary file not shown.
Binary file added images/Snake-Graphics/straight vertical.webp
Binary file not shown.
Binary file added images/Snake-Graphics/tail down.webp
Binary file not shown.
Binary file added images/Snake-Graphics/tail left.webp
Binary file not shown.
Binary file added images/Snake-Graphics/tail right.webp
Binary file not shown.
Binary file added images/Snake-Graphics/tail up.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Snake</title>
<link rel="shortcut icon" href="images/favicon-256x256.png">
<link rel="icon" type="image/x-icon" href="/images/favicon-256x256.png">
<link rel="stylesheet" href="snake.css">
</head>
<body>
Expand Down
13 changes: 7 additions & 6 deletions snake.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// ---- temp only for development ----
let temp;
temp = '!!temp42!!';
// ---- JS ----
// ----- temp only for development -----
let temp = '!!temp42!!';
// ----- JS ----- //
let board;
let blockSize = 25 % screen.height;
let rows = 20;
Expand All @@ -17,12 +16,13 @@ let snakeBody = [];
let gameOver = false;
let gameRunning = false;
let recentGame = [];

let allRecentGamesArr = [];
let highScoreArr = [0,0,0,0];
let newHighScoreWritten = false;


// ----- from/for HTML ----
// ----- from/for HTML -----
let liveScore = document.getElementById("score");
let newScore = 0;
let liveSeconds = document.getElementById("seconds");
Expand All @@ -49,6 +49,7 @@ let highLength = undefined;
let highColected = undefined;
let LSClearButton = document.getElementById("clearLSButton");


// --------------------------- End of Variables -------------------------------------------------------------

liveScore.innerHTML = '0';
Expand Down Expand Up @@ -82,7 +83,7 @@ function restart() {
}

function start () {
localStorageReader();
//localStorageReader();
updateHighScore();
for (let i = 0; i < allRecentGamesArr.length; i++) {
recentGamesTableWriter(i);
Expand Down