diff --git a/WebGames-master/WebGames-master/Robertgame/index.html b/WebGames-master/WebGames-master/Robertgame/index.html new file mode 100644 index 00000000..8a862e89 --- /dev/null +++ b/WebGames-master/WebGames-master/Robertgame/index.html @@ -0,0 +1,15 @@ + + + + + + Simple Game + + + +
+
+
+ + + \ No newline at end of file diff --git a/WebGames-master/WebGames-master/Robertgame/script.js b/WebGames-master/WebGames-master/Robertgame/script.js new file mode 100644 index 00000000..68b66b5d --- /dev/null +++ b/WebGames-master/WebGames-master/Robertgame/script.js @@ -0,0 +1,43 @@ +document.addEventListener('DOMContentLoaded', () => { + const player = document.getElementById('player'); + const gameContainer = document.querySelector('.game-container'); + const containerWidth = gameContainer.clientWidth; + const containerHeight = gameContainer.clientHeight; + const playerSize = 50; // Width and height of the player + + let playerX = 0; + let playerY = 0; + + function movePlayer(x, y) { + playerX += x; + playerY += y; + + // Ensure the player does not move out of the container + playerX = Math.max(0, Math.min(containerWidth - playerSize, playerX)); + playerY = Math.max(0, Math.min(containerHeight - playerSize, playerY)); + + player.style.left = `${playerX}px`; + player.style.top = `${playerY}px`; + } + + document.addEventListener('keydown', (event) => { + const step = 10; // Number of pixels to move + + switch (event.key) { + case 'ArrowUp': + movePlayer(0, -step); + break; + case 'ArrowDown': + movePlayer(0, step); + break; + case 'ArrowLeft': + movePlayer(-step); + break; + case 'ArrowRight': + movePlayer(step); + break; + default: + break; + } + }); +}); \ No newline at end of file diff --git a/WebGames-master/WebGames-master/Robertgame/style.css b/WebGames-master/WebGames-master/Robertgame/style.css new file mode 100644 index 00000000..992a44e4 --- /dev/null +++ b/WebGames-master/WebGames-master/Robertgame/style.css @@ -0,0 +1,26 @@ +body { + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #f0f0f0; +} + +.game-container { + width: 500px; + height: 500px; + background-color: #fff; + border: 2px solid #000; + position: relative; +} + +.player { + width: 50px; + height: 50px; + background-color: #ff0000; + position: absolute; + top: 0; + left: 0; +} \ No newline at end of file diff --git a/WebGames-master/WebGames-master/index.html b/WebGames-master/WebGames-master/index.html index 89348aa6..79e13696 100644 --- a/WebGames-master/WebGames-master/index.html +++ b/WebGames-master/WebGames-master/index.html @@ -1,11 +1,16 @@ - - - -

- - The Bubble Game - The Bubble Game - -

- - \ No newline at end of file + + + + + + + + +
+
+ tic-tac-toe + The Bubble Game + Game +
+ + \ No newline at end of file diff --git a/WebGames-master/WebGames-master/main.css b/WebGames-master/WebGames-master/main.css index 67db202f..9476ecfc 100644 --- a/WebGames-master/WebGames-master/main.css +++ b/WebGames-master/WebGames-master/main.css @@ -9,12 +9,13 @@ } html { - background-image: url("/image-robert-added/bgc4n1.gif"); + background-image: url("/image-robert-added/215837.gif"); background-attachment: scroll; background-size: cover; + z-index: 2; } -p.one { +div.one { -moz-box-shadow: 0 0 10px #777777; -webkit-box-shadow: 0 0 10px #777777; box-shadow: inset 0 0 10px #777777; @@ -23,8 +24,11 @@ p.one { -moz-border-radius: 10px; border-radius: 10px; padding: 20px; + text-align: left; + position: absolute; + z-index: 1; } -head.two { - text-align: left; +a:hover { + background-color: aquamarine; } \ No newline at end of file diff --git a/image-robert-added/215837.gif b/image-robert-added/215837.gif new file mode 100644 index 00000000..dda7f084 Binary files /dev/null and b/image-robert-added/215837.gif differ