diff --git a/src/Games/Arkanoid/App.css b/src/Games/Arkanoid/App.css deleted file mode 100644 index f2cfeeee0..000000000 --- a/src/Games/Arkanoid/App.css +++ /dev/null @@ -1,51 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - animation: App-logo-spin infinite 20s linear; - height: 80px; -} - -.App-header { - background-color: #222; - height: 150px; - padding: 20px; - color: white; -} - -.App-intro { - font-size: large; -} - -@keyframes App-logo-spin { - from { transform: rotate(0deg); } - to { transform: rotate(360deg); } -} - -/*############################################################################*/ -.Arkanoid-Board { - position: relative; - background-color: rgb(0, 0, 0); - margin-left: auto; - margin-right: auto; - width: 800px; - height: 600px; -} -.Paddle { - position: absolute; - border: 1px solid rgb(255, 0, 0); - border-radius: 10px; - width: 100px; - height: 15px; - background-color: white; -} -.Ball { - position: absolute; - border-radius: 50%; -} -.Plate { - position: absolute; - border: 1px solid black; - background-color: white; -} diff --git a/src/Games/Arkanoid/App.js b/src/Games/Arkanoid/App.js deleted file mode 100644 index e0fa6dd87..000000000 --- a/src/Games/Arkanoid/App.js +++ /dev/null @@ -1,261 +0,0 @@ -import React, { Component } from 'react'; -import './App.css'; - -const ROWS_COLORS = ["#ff9999","#b399ff","#9999ff","#b399ff","#0066ff","","#0052cc","#0047b3","#003d99"] - -const COLORS = ["#ff9999","#ffb399","#ffcc99","#ffe699","#ffff99","#e6ff99","#ccff99","#b3ff99","#99ff99","#99ffb3","#99ffcc","#99ffe6" -,"#99ffff","#99e6ff","#99ccff","#99b3ff","#9999ff","#b399ff","#cc99ff","#e699ff","#ff99ff","#ff99e6","#ff99cc","#ff99b3","#ff9999"]; - -const BOARD_WIDTH = 800; -const BOARD_HEIGHT = 500; - -const PADDLE_WIDTH = 100; -const PADDLE_HEIGHT = 15; -const PADDLE_STEP_SIZE = 30; -const PADDLE_TOP = 500*0.9; -const PADDLE_LEFT = (BOARD_WIDTH/2)-(PADDLE_WIDTH/2); - -const PLATE_HEIGHT = 15; -const PLATE_WIDTH = window.innerWidth*0.15; - -const DEFAULT_BALL_COLOR = '#ccff99'; -const BALL_SIZE = 20; -const DEFAULT_BALL_LEFT = (BOARD_WIDTH/4)-(BALL_SIZE/2); -const DEFAULT_BALL_TOP = (BOARD_HEIGHT/4)-(BALL_SIZE/2); - -const BALL_STEP_SIZE = 1.5; - -const START_TEXT = 'Welcome! Here' - -class Arkanoid extends Component { - constructor(props) { - super(props); - this.state = { - paddleLeft: PADDLE_LEFT, - paddleTop: PADDLE_TOP, - ballTop: DEFAULT_BALL_TOP, - ballLeft: DEFAULT_BALL_LEFT, - leftStepSize: BALL_STEP_SIZE, - topStepSize: BALL_STEP_SIZE, - ballSize: BALL_SIZE, - ballColor: DEFAULT_BALL_COLOR, - plateWidth: PLATE_WIDTH, - plateHeight: PLATE_HEIGHT, - platePositions: [], - buttonDisplay: 'inline-block', - ballDisplay: 'block', - buttonText: 'Start', - text: START_TEXT, - textDisplay: 'inline-block', - score: 0 - }; - this.handleKeyDown = this.handleKeyDown.bind(this); - this.startGame = this.startGame.bind(this); - this.gameLoop = this.gameLoop.bind(this); - this.pickColor = this.pickColor.bind(this); - this.toggelY = this.toggelY.bind(this); - this.toggelX = this.toggelX.bind(this); - this.calculatePlatePositions = this.calculatePlatePositions.bind(this); - this.checkWon = this.checkWon.bind(this); - this.checkFail = this.checkFail.bind(this); - } - - componentDidMount(){ - document.addEventListener("keydown", this.handleKeyDown, false); - this.calculatePlatePositions(); - } - - componentWillUnmount() { - document.removeEventListener("keydown", this.handleKeyDown, false); - } - - handleKeyDown = (event) => { - if (event.keyCode === 39 && (this.state.paddleLeft + PADDLE_STEP_SIZE) <= BOARD_WIDTH - PADDLE_WIDTH){ - this.setState({paddleLeft: (this.state.paddleLeft + PADDLE_STEP_SIZE)}) - } else if (event.keyCode === 37 && (this.state.paddleLeft - PADDLE_STEP_SIZE) >= 0) { - this.setState({paddleLeft: (this.state.paddleLeft - PADDLE_STEP_SIZE)}) - } - } - - startGame(text) { - if (this.state.buttonText === 'Restart') { - this.setState({ - ballTop: DEFAULT_BALL_TOP, - ballLeft: DEFAULT_BALL_LEFT, - ballDisplay: 'block', - score: 0, - buttonDisplay: 'none', - textDisplay: 'none' - }); - - this.calculatePlatePositions(); - this.gameLoop(); - } else if (this.state.buttonText === 'Start') { - this.setState({ - buttonDisplay: 'none', - textDisplay: 'none' - }); - - this.gameLoop(); - } - } - - pickColor() { - return COLORS[Math.floor(Math.random() * COLORS.length)]; - } - - toggelY() { - this.setState({topStepSize: -this.state.topStepSize}) - this.setState({ballColor: this.pickColor()}) - } - - toggelX() { - this.setState({leftStepSize: -this.state.leftStepSize}) - this.setState({ballColor: this.pickColor()}) - } - - calculatePlatePositions() { - const amount = Math.floor(BOARD_WIDTH/(PLATE_WIDTH+2)) - const rows = Math.floor((BOARD_HEIGHT/4)/(PLATE_HEIGHT+2))/2 - const arr = []; - for (var i = 0; i < rows; i++) { - for (var j = 0; j < amount; j++) { - arr.push([(i*(PLATE_HEIGHT+2) + PLATE_HEIGHT), (j*(PLATE_WIDTH+2) + ((BOARD_WIDTH - (amount*PLATE_WIDTH))/2)), ROWS_COLORS[i]]) - } - } - this.setState({platePositions: arr}) - } - - checkWon() { - return this.state.platePositions.length === 0 ? true : false - } - checkFail() { - return this.state.ballTop + BALL_SIZE >= (PADDLE_TOP + PADDLE_HEIGHT) ? true : false - } - - gameLoop() { - for (var i = 0; i < this.state.platePositions.length; i++) { - if ((this.state.ballTop + BALL_SIZE + BALL_STEP_SIZE) >= (this.state.platePositions[i][0] - 1) && (this.state.ballTop) <= (this.state.platePositions[i][0] + PLATE_HEIGHT + 1) - && (this.state.ballLeft + BALL_SIZE + BALL_STEP_SIZE) >= this.state.platePositions[i][1] && this.state.ballLeft <= (this.state.platePositions[i][1] + PLATE_WIDTH)) { - this.state.platePositions.splice(i, 1); - this.setState({score: this.state.score + 100}) - this.toggelY() - } - } - - if (this.checkWon()) { - console.log('won') - this.setState({ballDisplay: 'none'}) - this.setState({buttonDisplay: 'inline-block'}) - this.setState({textDisplay: 'inline-block'}) - this.setState({text: 'You Won!'}) - this.setState({buttonText: 'Restart'}) - } else if (this.checkFail()) { - console.log('fail') - this.setState({ballDisplay: 'none'}) - this.setState({buttonDisplay: 'inline-block'}) - this.setState({textDisplay: 'inline-block'}) - this.setState({text: 'GAME OVER'}) - this.setState({buttonText: 'Restart'}) - } else { - - if (this.state.ballLeft >= (BOARD_WIDTH - BALL_SIZE - BALL_STEP_SIZE) || this.state.ballLeft <= 0){ - this.toggelX() - } - - if (this.state.ballTop <= 0){ - this.toggelY() - } - - if ((this.state.ballTop + BALL_STEP_SIZE + BALL_SIZE) > PADDLE_TOP && (this.state.ballTop + BALL_STEP_SIZE + BALL_SIZE) > PADDLE_TOP + PADDLE_HEIGHT/4 - && (this.state.ballLeft + BALL_STEP_SIZE + BALL_SIZE) >= this.state.paddleLeft + 1 - && (this.state.ballLeft + BALL_STEP_SIZE) <= (this.state.paddleLeft + PADDLE_WIDTH + 2)){ - this.toggelY() - this.toggelX() - } else if ((this.state.ballTop + BALL_STEP_SIZE + BALL_SIZE) >= PADDLE_TOP - && (this.state.ballLeft + BALL_STEP_SIZE + BALL_SIZE) >= this.state.paddleLeft + 1 - && (this.state.ballLeft + BALL_STEP_SIZE) <= (this.state.paddleLeft + PADDLE_WIDTH + 2)){ - this.toggelY() - } - - this.setState({ballTop: (this.state.ballTop + this.state.topStepSize)}) - this.setState({ballLeft: (this.state.ballLeft + this.state.leftStepSize)}) - setTimeout(function() { this.gameLoop(); }.bind(this), 0); - } - } - render() { - return ( -
-
- {this.state.text} - - - - - - -
Arkanoid Game Play Hard!
-
Your score: {this.state.score}
-
-
- ); - } -} - -const Text = ({className, children, display}) => { return ( -
- {children} -
); -} -const Paddle = ({className, leftPosition, topPosition}) => { return (
); } -const Plate = ({className, platePositions, plateWidth, plateHeight}) => { - return ( -
- {platePositions.map((item, index) => -
- )} -
- ) -} -const Ball = ({className, ballLeft, ballTop, onClick, ballSize, ballColor, display}) => { - return (
-
); -} -const Button = ({onClick, className, display, children}) => { - return ( -
- -
- ); -} - -export default Arkanoid; diff --git a/src/Games/DiceThrow/main.js b/src/Games/DiceThrow/main.js index 433cae4ac..9a757e186 100644 --- a/src/Games/DiceThrow/main.js +++ b/src/Games/DiceThrow/main.js @@ -103,9 +103,10 @@ const Game = (props) => {

Set target:

Turn: Player {turn}

-

{score1} :

-

 {score2}

- +

{score1}

+         +

{score2}

+ diff --git a/src/Games/Typo/components/main-game/MainGame.js b/src/Games/Typo/components/main-game/MainGame.js index 73e2a181b..0e0c1759a 100644 --- a/src/Games/Typo/components/main-game/MainGame.js +++ b/src/Games/Typo/components/main-game/MainGame.js @@ -25,7 +25,7 @@ const MainGame = () => { />

- Timer : {timeRemaning}s {"\n"} + Timer : {timeRemaning} s

-

+

Word Count : {wordCount} w/m

{isOver && ( -

Your Speed is{wordCount} Words/Minute

+

Your Speed is {wordCount} Words/Minute

)} {isOver && } diff --git a/src/Games/Typo/components/main-game/main-game.css b/src/Games/Typo/components/main-game/main-game.css index f17116838..52c312bbe 100644 --- a/src/Games/Typo/components/main-game/main-game.css +++ b/src/Games/Typo/components/main-game/main-game.css @@ -79,6 +79,5 @@ button:disabled { textarea { width: 100%; padding: 0; - /* height: 496px; */ } } diff --git a/src/Games/Typo/typo.css b/src/Games/Typo/typo.css index c54f4ef1d..cc0ee163c 100644 --- a/src/Games/Typo/typo.css +++ b/src/Games/Typo/typo.css @@ -1,15 +1,13 @@ .heading { margin-top: 1em; - margin-bottom: 20px !important; - margin-left: 50px; + margin-bottom: 0; color: white; text-align: center; display: flex; align-items: center; gap: 10px; - font-size: 1.8rem; - justify-content: flex-start; - width: 50vw; + font-size: 1.7rem; + justify-content: center; } .container { diff --git a/src/Homepage/Data/data.js b/src/Homepage/Data/data.js index f36e9f11d..a82add31b 100644 --- a/src/Homepage/Data/data.js +++ b/src/Homepage/Data/data.js @@ -1,104 +1,111 @@ -import React from "react"; -//Add the following data in the card for the game you have added. For any instructions refer to contributing.md - -export const data1 = [ - { - serial_number: "01", - main_heading: "Let's Play Tic-Tac-Toe", - about: - "A fun and interesting tic tac toe game to take us back to the good old childhood days!", - link_game: "/Tic", - }, - { - serial_number: "02", - main_heading: "Ninety - Nine", - about: "A game you can never win.", - link_game: "/99", - }, - { - serial_number: "03", - main_heading: "Memory", - about: "Can you remember ?", - link_game: "/memory", - }, - { - serial_number: "04", - main_heading: "Trivia", - about: "Can you guess it right ?", - link_game: "/trivia", - }, - { - serial_number: "05", - main_heading: "15 Puzzle", - about: "Can you solve it?", - link_game: "/15puzzle", - }, - { - serial_number: "06", - main_heading: "Rock Paper and Scissors", - about: "Can you win against the computer?", - link_game: "/rock-paper-scissors", - }, - { - serial_number: "07", - main_heading: "Brick Breakout", - about: "Let's break out the brick wall with the ball", - link_game: "/brick-breakout", - }, - { - serial_number: "08", - main_heading: "Typo - Typing Tester", - about: - "Accept Challenge if you think your typing speed is more than Usain Bolt's sprint ", - link_game: "/typo", - }, - { - serial_number: "09", - main_heading: "Ball Shooting", - about: - "Shoot the projectiles in the direction of the mouse clicked and survive for as long as you can", - link_game: "/BallShooting", - }, - { - serial_number: "10", - main_heading: "Magic Matching", - about: "Flip the cards till you match the cards ", - link_game: "/MagicMatch", - }, - { - serial_number: "11", - main_heading: "Dice Throw", - about: "Roll the dice and achieve a target ", - link_game: "/DiceThrow", - }, - { - serial_number: "12", - main_heading: "Wordle", - about: "Put your vocabulary to test", - link_game: "/Wordle", - }, - { - serial_number: "13", - main_heading: "SnakeGame", - about: "Slither and Conquer!", - link_game: "/SnakeGame", - }, - { - serial_number: "14", - main_heading: "Tetris", - about: "Put the blocks at right place", - link_game: "/tetris", - }, - { - serial_number: "15", - main_heading: "Battle Ships", - about: "search and Destroy Enemies ships", - link_game: "/Battle", - }, - { - serial_number: "16", - main_heading: "Arkanoid", - about: "Complete all bricks", - link_game: "/Arkanoid", - } -]; +import React from "react"; +//Add the following data in the card for the game you have added. For any instructions refer to contributing.md + +export const data1 = [ + { + serial_number: "01", + main_heading: "Let's Play Tic-Tac-Toe", + about: + "Interesting tic tac toe game to bring us back to the childhood days!", + link_game: "/Tic", + }, + { + serial_number: "02", + main_heading: "Ninety - Nine", + about: "A game you can never win.", + link_game: "/99", + }, + { + serial_number: "03", + main_heading: "Memory", + about: "Can you remember ?", + link_game: "/memory", + }, + { + serial_number: "04", + main_heading: "Trivia", + about: "Can you guess it right ?", + link_game: "/trivia", + }, + { + serial_number: "05", + main_heading: "15 Puzzle", + about: "Can you solve it?", + link_game: "/15puzzle", + }, + { + serial_number: "06", + main_heading: "Rock Paper and Scissors", + about: "Can you win against the computer?", + link_game: "/rock-paper-scissors", + }, + { + serial_number: "07", + main_heading: "Brick Breakout", + about: "Let's break out the brick wall with the ball", + link_game: "/brick-breakout", + }, + { + serial_number: "08", + main_heading: "Typo - Typing Tester", + about: + "Accept Challenge if you think your typing speed is more than Usain Bolt's sprint ", + link_game: "/typo", + }, + { + serial_number: "09", + main_heading: "Ball Shooting", + about: + "Shoot the projectiles in the direction of the mouse clicked and survive for as long as you can", + link_game: "/BallShooting", + }, + { + serial_number: "10", + main_heading: "Magic Matching", + about: "Flip the cards till you match the cards ", + link_game: "/MagicMatch", + }, + { + serial_number: "11", + main_heading: "Dice Throw", + about: "Roll the dice and achieve a target ", + link_game: "/DiceThrow", + }, + { + serial_number: "12", + main_heading: "Wordle", + about: "Put your vocabulary to test", + link_game: "/Wordle", + }, + { + serial_number: "13", + main_heading: "SnakeGame", + about: "Slither and Conquer!", + link_game: "/SnakeGame", + }, + { + serial_number: "14", + main_heading: "Tetris", + about: "Put the blocks at right place", + link_game: "/tetris", + }, + { + serial_number: "15", + main_heading: "Battle Ships", + about: "search and Destroy Enemies ships", + link_game: "/Battle", + }, + { + serial_number: "16", + main_heading: "Drag and Drop", + about: "Drag the cards from the middle section and drop them into the similar one.", + link_game: "/DragAndDrop", + }, + { + serial_number: "17", + main_heading: "Let's Play Tic-Tac-Toe with AI", + about: + "Can you compete with AI...", + link_game: "/Tictac", + }, +]; diff --git a/src/Routes/AllRoutes.js b/src/Routes/AllRoutes.js index 58e4212c7..6189ea5f4 100644 --- a/src/Routes/AllRoutes.js +++ b/src/Routes/AllRoutes.js @@ -1,46 +1,48 @@ -import { BrowserRouter as Router, Route, Routes } from "react-router-dom"; - -import Homepage from "../Homepage/Homepage/Homepage"; -import Tictactoe from "../Games/Tictactoe/tictactoe"; -import Ninetynine from "../Games/Ninetynine/ninetynine"; -import Memory from "../Games/Memory/memory"; -import TriviaGame from "../Games/Trivia/quiz"; -import Fifteenpuzzle from "../Games/15Puzzle/Fifteenpuzzle"; -import RockPaperScissors from "../Games/RockPaperScissors/RockPaperScissors"; -import BrickBreakout from "../Games/BrickBreakout/BrickBreakout"; -import Typo from "../Games/Typo/Typo"; -import BallShooting from "../Games/BallShooting/BallShooting"; -import MagicMatch from "../Games/Magic-match/magic_match"; -import DiceThrow from "../Games/DiceThrow/main"; -import Wordle from "../Games/Wordle/Wordle"; -import SnakeGame from "../Games/SnakeGame/SnakeGame"; -import Tetris from "../Games/tetris/src/components/Tetris"; -import Battle from "../Games/BattleShip/App" -import Arkanoid from "../Games/Arkanoid/App"; - -function AllRoutes() { - return ( - - {/* Add all the routes with the right path here after importing them */} - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - ); -} - -export default AllRoutes; +import { BrowserRouter as Router, Route, Routes } from "react-router-dom"; + +import Homepage from "../Homepage/Homepage/Homepage"; +import Tictactoe from "../Games/Tictactoe/tictactoe"; +import Ninetynine from "../Games/Ninetynine/ninetynine"; +import Memory from "../Games/Memory/memory"; +import TriviaGame from "../Games/Trivia/quiz"; +import Fifteenpuzzle from "../Games/15Puzzle/Fifteenpuzzle"; +import RockPaperScissors from "../Games/RockPaperScissors/RockPaperScissors"; +import BrickBreakout from "../Games/BrickBreakout/BrickBreakout"; +import Typo from "../Games/Typo/Typo"; +import BallShooting from "../Games/BallShooting/BallShooting"; +import MagicMatch from "../Games/Magic-match/magic_match"; +import DiceThrow from "../Games/DiceThrow/main"; +import Wordle from "../Games/Wordle/Wordle"; +import SnakeGame from "../Games/SnakeGame/SnakeGame"; +import Tetris from "../Games/tetris/src/components/Tetris"; +import Battle from "../Games/BattleShip/App" +import App from "../Games/DragAndDrop/App" +import TicTacToeAI from "../Games/TicTactoeAI/app"; + +function AllRoutes() { + return ( + + {/* Add all the routes with the right path here after importing them */} + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + ); +} + +export default AllRoutes;