Skip to content
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

Ant Smasher game #4554

Merged
merged 10 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
20 changes: 20 additions & 0 deletions Games/Ant_Smasher/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# **Game_Name**

Ant Smasher

## **Description 📃**

Frontend game developed using HTML, CSS, JavaScript. Player has to kill all the Ants

## **functionalities 🎮**

- Player has to kill all the Ants by Smashing it.

## **How to play? 🕹️**

- Click the Start button to start the game
- When players hits the ant the score will get increased.

## **Screenshots 📸**

![alt text](./img/image.png)
Binary file added Games/Ant_Smasher/img/ant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions Games/Ant_Smasher/img/dirt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Games/Ant_Smasher/img/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions Games/Ant_Smasher/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ant Smasher Game</title>
<link href='https://fonts.googleapis.com/css?family=Amatic+SC:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css">
</head>
<body>

<h1>Ant Smasher<span class="score">0</span></h1>
<button onClick="startGame()" style="float:right;">Start</button>

<div class="game">
<div class="hole hole1">
<div class="mole"></div>
</div>
<div class="hole hole2">
<div class="mole"></div>
</div>
<div class="hole hole3">
<div class="mole"></div>
</div>
<div class="hole hole4">
<div class="mole"></div>
</div>
<div class="hole hole5">
<div class="mole"></div>
</div>
<div class="hole hole6">
<div class="mole"></div>
</div>
</div>

<script src="script.js"></script>
</body>
</html>
47 changes: 47 additions & 0 deletions Games/Ant_Smasher/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const holes = document.querySelectorAll(".hole");
const scoreBoard = document.querySelector(".score");
const moles = document.querySelectorAll(".mole");
let lastHole;
let timeUp = false;
let score = 0;

function randomTime(min, max) {
return Math.round(Math.random() * (max - min) + min);
}

function randomHole(holes) {
const idx = Math.floor(Math.random() * holes.length);
const hole = holes[idx];
if (hole === lastHole) {
return randomHole(holes);
}
lastHole = hole;
return hole;
}

function peep() {
const time = randomTime(500, 2000);
const hole = randomHole(holes);
hole.classList.add("up");
setTimeout(() => {
hole.classList.remove("up");
if (!timeUp) peep();
}, time);
}

function startGame() {
scoreBoard.textContent = 0;
timeUp = false;
score = 0;
peep();
setTimeout(() => (timeUp = true), 10000);
}

function bonk(e) {
if (!e.isTrusted) return; // cheater!
score++;
this.parentNode.classList.remove("up");
scoreBoard.textContent = score;
}

moles.forEach((mole) => mole.addEventListener("click", bonk));
71 changes: 71 additions & 0 deletions Games/Ant_Smasher/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
html {
box-sizing: border-box;
font-size: 10px;
background: #9b7653;
}

*,
*:before,
*:after {
box-sizing: inherit;
}

body {
padding: 0;
margin: 0;
font-family: "Amatic SC", cursive;
}

h1 {
text-align: center;
font-size: 10rem;
line-height: 1;
margin-bottom: 0;
}

.score {
background: rgba(255, 255, 255, 0.2);
padding: 0 3rem;
line-height: 1;
border-radius: 1rem;
}

.game {
width: 600px;
height: 400px;
display: flex;
flex-wrap: wrap;
margin: 0 auto;
}

.hole {
flex: 1 0 33.33%;
overflow: hidden;
position: relative;
}

.hole:after {
display: block;
background: url(./img/dirt.svg) bottom center no-repeat;
background-size: contain;
content: "";
width: 100%;
height: 70px;
position: absolute;
z-index: 2;
bottom: -30px;
}

.mole {
background: url("./img/ant.png") bottom center no-repeat;
background-size: 60%;
position: absolute;
top: 100%;
width: 100%;
height: 100%;
transition: all 0.4s;
}

.hole.up .mole {
top: 0;
}
36 changes: 18 additions & 18 deletions README.md
mukilan2815 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ This repository also provides one such platforms where contributers come over an
| [Mastermind_Mania](https://github.com/kunjgit/GameZone/tree/main/Games/Mastermind_Mania) | [Ludo_4_Player](https://github.com/kunjgit/GameZone/tree/main/Games/Ludo_4_Player) | [AirBalloon](https://github.com/kunjgit/GameZone/tree/main/Games/AirBalloon) | [Space Invaders](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Invaders) | [Cut the Rope](https://github.com/kunjgit/GameZone/tree/main/Games/Cut_the_rope) |
| [Caesar&Cipher](https://github.com/kunjgit/GameZone/tree/main/Games/Caesar_Cipher) | [Monster_Maker](https://github.com/kunjgit/GameZone/tree/main/Games/Monster_Maker) | [Stolen Sword](https://github.com/kunjgit/GameZone/tree/main/Games/Stolen_Sword) | [Mastermind](https://github.com/kunjgit/GameZone/tree/main/Games/Mastermind) | [Highway 404](https://github.com/kunjgit/GameZone/tree/main/Games/Highway_404) |
| [BullseyeGame](https://github.com/kunjgit/GameZone/tree/main/Games/BullseyeGame) | [Crossword Game](https://github.com/kunjgit/GameZone/tree/main/Games/Crossword_Game) | [Guess the Correct Logo](https://github.com/shruti-2412/GameZone/tree/main/Games/Guess_The_Correct_Logo) | [Painting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Painting_Game) | [Platform_game_engine](https://github.com/kunjgit/GameZone/tree/main/Games/Platform_game_engine) |
| [Kill_The_Bird](https://github.com/kunjgit/GameZone/tree/main/Games/Kill_The_Bird) |
| [Kill_The_Bird](https://github.com/kunjgit/GameZone/tree/main/Games/Kill_The_Bird) |
| [Doppelkopf](https://github.com/kunjgit/GameZone/tree/main/Games/Doppelkopf) | [quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/quiz_game) | [Island Survival](https://github.com/kunjgit/GameZone/tree/main/Games/Island_Survival) | [Linkup Game](https://github.com/kunjgit/GameZone/tree/main/Games/linkup) | [Trivia_Card](https://github.com/kunjgit/GameZone/tree/main/Games/Trivia_Card) |
| [Insect Catch Game](https://github.com/kunjgit/GameZone/tree/main/Games/Insect_Catch_Game) | [Carnival_game](https://github.com/kunjgit/GameZone/tree/main/Games/Carnival_game) | [Make Me Laugh](https://github.com/kunjgit/GameZone/tree/main/Games/Make_Me_Laugh) | [Avoider_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Avoider_Game) | [Dungeon_Crawler](https://github.com/kunjgit/GameZone/tree/main/Games/Dungeon_Crawler) |
| [snake_water_gun](https://github.com/kunjgit/GameZone/tree/main/Games/snake_water_gun) | [Run and Jump](https://github.com/kunjgit/GameZone/tree/main/Games/Run_and_Jump) | [AI CHESS Game](https://github.com/kunjgit/GameZone/tree/main/Games/AI_CHESS_Game) | [Fruit_Catching](https://github.com/kunjgit/GameZone/tree/main/Games/Fruit_Catching) | [Bulls eye](https://github.com/kunjgit/GameZone/tree/main/Games/Bulls_eye) |
Expand Down Expand Up @@ -190,6 +190,7 @@ This repository also provides one such platforms where contributers come over an
| [numeral-whiz](https://github.com/Ishan-77/GameZone/tree/main/Games/numeral-whiz) | [candy_match](https://github.com/kunjgit/GameZone/tree/main/Games/Candy_Match_Saga) | [Crossy_Road](https://github.com/tanujbordikar/GameZone/tree/Crossy_Road) | [HueHero](https://github.com/kunjgit/GameZone/tree/main/Games/HueHero) | [Puzzel_Winner](https://github.com/kunjgit/GameZone/tree/main/Games/Puzzel_Winner) |
| [Emoji_Intruder](https://github.com/kunjgit/GameZone/tree/main/Games/Emoji_Intruder) | [Guess The Weapon](https://github.com/kunjgit/GameZone/tree/main/Games/Guess_The_Weapon) | [Guess Who](https://github.com/kunjgit/GameZone/tree/main/Games/Guess_Who) | [Pop My Balloon](https://github.com/kunjgit/GameZone/tree/main/Games/Pop_My_Balloon) | [Color_Blast](https://github.com/kunjgit/GameZone/tree/main/Games/Color_Blast) |
| [Maze_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Maze_Game) | [Coloron](https://github.com/kunjgit/GameZone/tree/main/Games/Coloron). |

| [Black_jackk](https://github.com/kunjgit/GameZone/tree/main/Games/Black_jackk)
| [Earth_Guardian](https://github.com/kunjgit/GameZone/tree/main/Games/Earth_Guardian) |
| [escaperoom](https://github.com/kunjgit/GameZone/tree/main/Games/escaperoom)
Expand All @@ -198,11 +199,11 @@ This repository also provides one such platforms where contributers come over an
| [Emoji_Intruder](https://github.com/kunjgit/GameZone/tree/main/Games/Emoji_Intruder) | [Guess The Weapon](https://github.com/kunjgit/GameZone/tree/main/Games/Guess_The_Weapon) | [Guess Who](https://github.com/kunjgit/GameZone/tree/main/Games/Guess_Who) | [Pop My Balloon](https://github.com/kunjgit/GameZone/tree/main/Games/Pop_My_Balloon) | [Tower Stack](https://github.com/kunjgit/GameZone/tree/main/Games/Tower_Stack) |
| [Maze_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Maze_Game) | [TriHand_Tactics](https://github.com/kunjgit/GameZone/tree/main/Games/TriHand_Tactics) | [Earth_Guardian](https://github.com/kunjgit/GameZone/tree/main/Games/Earth_Guardian) | [Ball_Shooting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_Shooting_Game) |
| [Ball_Shooting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_Shooting_Game) | [CatchTheBall](https://github.com/kunjgit/GameZone/tree/main/Games/CatchTheBall) |
| [Ball_Shooting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_Shooting_Game) |
| [CopyCat](https://github.com/kunjgit/GameZone/tree/main/Games/CopyCat) |
| [Ball_Shooting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_Shooting_Game) |
| [CopyCat](https://github.com/kunjgit/GameZone/tree/main/Games/CopyCat) |
[DoraemonRun ](https://github.com/kunjgit/GameZone/tree/main/Games/DoraemonRun) |
| [Memory_Cards_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Memory_Cards_Game) |
| [Typing_Speed_Test2](https://github.com/kunjgit/GameZone/tree/main/Games/Typing_Speed_Test2) | [Tic Tac Toe Responsive ](https://github.com/kunjgit/GameZone/tree/main/Games/Tic_tac_toe_responsive) | [Minesweeper Easy ](https://github.com/kunjgit/GameZone/tree/main/Games/MineSweeper_Easy) |
| [Typing_Speed_Test2](https://github.com/kunjgit/GameZone/tree/main/Games/Typing_Speed_Test2) | [Tic Tac Toe Responsive ](https://github.com/kunjgit/GameZone/tree/main/Games/Tic_tac_toe_responsive) | [Minesweeper Easy ](https://github.com/kunjgit/GameZone/tree/main/Games/MineSweeper_Easy) |
| [Technical_Mind_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Technical_Mind_Game) |
[Slide_Master_Puzzle](https://github.com/kunjgit/GameZone/tree/Main/Games/Slide_Master_Puzz)| |
| [Ball_Shooting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_Shooting_Game) | [Letter_Sleuth](https://github.com/swetha5157/GameZone/tree/main/Games/Letter_Sleuth)
Expand Down Expand Up @@ -330,9 +331,9 @@ This repository also provides one such platforms where contributers come over an
| [Find_the_ball](https://github.com/kunjgit/GameZone/tree/main/Games/Find_the_ball) |
|[Color The Page](https://github.com/kunjgit/GameZone/tree/main/Games/Color_The_Page)|
|[Lunar Lander](https://github.com/kunjgit/GameZone/tree/main/Games/Lunar_Lander)|
|[AquaSort_Game](https://github.com/kunjgit/GameZone/tree/main/Games/AquaSort_Game) |
|[Chess_Game_computer](https://github.com/kunjgit/GameZone/tree/main/Games/Chess_Game_computer) |
|[Turn_on_the_light](https://github.com/kunjgit/GameZone/tree/main/Games/Turn_on_the_light) |
|[AquaSort_Game](https://github.com/kunjgit/GameZone/tree/main/Games/AquaSort_Game) |
|[Chess_Game_computer](https://github.com/kunjgit/GameZone/tree/main/Games/Chess_Game_computer) |
|[Turn_on_the_light](https://github.com/kunjgit/GameZone/tree/main/Games/Turn_on_the_light) |
|[AquaSort_Game](https://github.com/kunjgit/GameZone/tree/main/Games/AquaSort_Game) |
| [Snake](https://github.com/kunjgit/GameZone/tree/main/Games/snake)                |
| [Tetris Game](https://github.com/kunjgit/GameZone/tree/main/Games/tetris_game)|
Expand All @@ -342,34 +343,33 @@ This repository also provides one such platforms where contributers come over an
| [Bubble'z Popper](https://github.com/Chandu6702/GameZone/tree/Bubble'z-Popper/Games/Bubble'z%20Popper
| [Dsa_quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/Dsa_quiz_game) |
| [Gravity_Simulation_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Gravity_Simulation_Game) |
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy)
| [Ball_in_Maze](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_in_Maze) |
|[Dsa_quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/Dsa_quiz_game) |
| [Gravity_Simulation_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Gravity_Simulation_Game)
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy)
| [Ball_in_Maze](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_in_Maze) |
|[Dsa_quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/Dsa_quiz_game) |
| [Gravity_Simulation_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Gravity_Simulation_Game)
| [Anagarm-Word-Game](https://github.com/kunjgit/GameZone/tree/main/Games/Anagarm-Word-Game) |
| [Brick Buster Game](https://github.com/kunjgit/GameZone/tree/main/Games/Brick Buster) |
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy)
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy)
| [Alphabet-and-Vowels](https://github.com/kunjgit/GameZone/tree/main/Games/Alphabet-and-Vowels) |
| [Brick Buster Game](https://github.com/kunjgit/GameZone/tree/main/Games/Brick%20Buster) |
| [Penguins Can't Fly](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Penguins_Can't_Fly) |
| [Intellect Quest](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Intellect_Quest) |
| [Number_Guessing_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Number_Guessing_Game) |
| [Fruit_Slicer_Game] (https://github.com/narayani9120/GameZone_B/tree/main/Games/Fruit_Slicer_Game) |
| [Fruit_Slicer_Game] (https://github.com/narayani9120/GameZone_B/tree/main/Games/Fruit_Slicer_Game) |
| [Tower_Block_Game](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Tower_Block_Game) |
| [Modulo_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Modulo_Game) |
| [Memory_Matching_Game](https://github.com/Saipradyumnagoud/GameZone/tree/main/Games/Memory_Matching_Game) |
|[Penguins Can't Fly](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Penguins_Can't_Fly)|
| [Block_Ninja] (https://github.com/kunjgit/GameZone/tree/main/Games/Block_Ninja) |
| [Shoot_Duck_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Shoot_Duck_Game) |
| [Block_Ninja] (https://github.com/kunjgit/GameZone/tree/main/Games/Block_Ninja) |
| [Shoot_Duck_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Shoot_Duck_Game) |
| [Disney_Trivia](https://github.com/manmita/GameZone/tree/Disney_Trivia/Games/Disney_Trivia)|
|[Harmony_Mixer](https://github.com/kunjgit/GameZone/tree/main/Games/Harmony_Mixer)|
| [Helicopter_Game](https://github.com/kinjgit/GameZone/tree/main/Games/Helicopter_Game) |
| [Bouncing Ball Game](https://github.com/kunjgit/GameZone/tree/main/Games/Bouncing_Ball_Game) |
| [Disney_Trivia](https://github.com/manmita/GameZone/tree/Disney_Trivia/Games/Disney_Trivia)|
|[Harmony_Mixer](https://github.com/kunjgit/GameZone/tree/main/Games/Harmony_Mixer)|
|[Steam_Punk](https://github.com/kunjgit/GameZone/tree/main/Games/Steam_Punk)|
|[Tower Defence Game](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Tower_Defence_Game)|

|[Tower Defence Game](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Tower_Defence_Game) | | [Ant Smasher Game](https://github.com/mukilan2815/GameZone/tree/main/Games/Ant_Smasher)|
mukilan2815 marked this conversation as resolved.
Show resolved Hide resolved

</center>

Expand Down Expand Up @@ -433,4 +433,4 @@ Terms and conditions for use, reproduction and distribution are under the [Apach
</center>
<br>

<p align="right"><a href="#top">Back to top</a></p>
<p align="right"><a href="#top">Back to top</a></p>