Skip to content

Commit

Permalink
updated files
Browse files Browse the repository at this point in the history
  • Loading branch information
rishiofficial committed Oct 25, 2023
1 parent 0f3cb11 commit 26e2249
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Games/Chrome_Dinosaur_Game/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ window.onload = function () {
document.addEventListener("keydown", moveDino);
}

function update() {
function update(e) {
requestAnimationFrame(update);
if(gameOver){
if(e.code == "KeyR"){
Expand Down Expand Up @@ -132,7 +132,7 @@ function moveDino(e) {

}

function placeCactus() {
function placeCactus(e) {
if(gameOver){
if(e.code == "KeyR"){
resetGame();
Expand Down
28 changes: 16 additions & 12 deletions Games/Snake_Game/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Snake Game</title>

<!-- external css -->
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div class="body"><div id="scoreBox">Score: 0</div><div id="HiScore">HiScore: 0</div><div id="board"></div></div>

</body>
<script src="./script.js"></script>
</html>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div class="body">
<div id="scoreBox">Score: 0</div>
<div id="HiScore">HiScore: 0</div>
<div><button onClick="easy()">Easy</button></div>
<div id="board"></div>
</div>
</body>
<script src="./script.js"></script>
</html>
8 changes: 7 additions & 1 deletion Games/Snake_Game/script.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//Game requirements
let inputDir={x:0,y:0}
let direction={x:0,y:0};
let speed=10;
// let speed=10;
let score=0;
let lastPaintTime=0;
let snakeArr=[{x:Math.round(2+16*Math.random()),y:Math.round(2+16*Math.random())}];
Expand All @@ -11,6 +11,12 @@ let gameOverSound=new Audio('./assets/gameover.mp3');
let moveSound=new Audio ('./assets/move.mp3');
let musicSound=new Audio('./assets/music.mp3')

//game level

function easy(){
let speed = 10
}

//Game Function
function isCollide(snakeArr){
//Self Bump
Expand Down
7 changes: 4 additions & 3 deletions Games/Snake_Game/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@
background-image:linear-gradient(yellow,orange);
border: .25vmin solid black;
border-radius:50% ;
=======
body {
}

/* body {
font-family: 'Courier New', Courier, monospace;
font-size: 2rem;
color: white;
Expand All @@ -73,4 +74,4 @@ h1{
}
p{
margin: 0.5rem;
}
} */

0 comments on commit 26e2249

Please sign in to comment.