Skip to content

Commit

Permalink
Adding main files
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakesh9100 committed Sep 14, 2022
1 parent 4fa5ce4 commit 94bd2bd
Show file tree
Hide file tree
Showing 18 changed files with 525 additions and 0 deletions.
128 changes: 128 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
10 changes: 10 additions & 0 deletions .github/CONTRIBUTING_GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contributing Guidelines

- The contributors will be allowed to work on the issue ONLY after it has been assigned to them.
- The contributions will be counted only for the time period of the event, after the time period ends contributions can be taken in but wont be counted for the final evaluation.
- Tampering or any unethical behaviour to the files or other participants will result in immediate disqualification.
- Each PR must be associated with only ONE issue.
- Don't open pull requests with minor text edits on other people's repositories.
- Don't create multiple issue request for one issue.

### Happy Contributing !!
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/create_an_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create an issue
description: Create an issue to start working on your script
title: "[Issue title here] "
body:
- type: markdown
attributes:
value: |
Create an issue to start working on your project
- type: checkboxes #prerequisites
attributes:
label: Prerequisites
description: Please answer the following questions for yourself before submitting an issue.
options:
- label: I am an Open Source Contributor
required: true
- label: I checked to make sure that this issue has not already been filed
required: true
- type: textarea #description
attributes:
label: Description
description: Tell us about this issue
placeholder: Describe here!
validations:
required: true
- type: textarea #screenshots
attributes:
label: Screenshots
description: Please attach any screenshots for better reference
placeholder: Describe here!
- type: checkboxes #terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Rakesh9100/Click-The-Edible-Game/blob/main/.github/CODE_OF_CONDUCT.md)
options:
- label: I follow [Contributing Guidelines](https://github.com/Rakesh9100/Click-The-Edible-Game/blob/main/.github/CONTRIBUTING_GUIDELINES.md) of this project.
required: true

30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Fixes Issue🛠️

<!-- Example: Closes #31 -->

Closes #

# Description👨‍💻

<!--Please include a summary of the change and which issue is fixed.List any dependencies that are required for this change.-->

# Type of change📄

<!--Please delete options that are not relevant.-->

- [] Bug fix (non-breaking change which fixes an issue)
- [] New feature (non-breaking change which adds functionality)

# How this has been tested✅

<!--Please describe the tests that you ran to verify your changes.-->

# Checklist✅

- [] My code follows the style guidelines of this project
- [] I have performed a self-review of my own code
- [] I have commented my code, particularly in hard-to-understand areas
- [] I have added demonstration in the form of GIF/video file
- [] I am an Open Source Contributor

# Screenshots/GIF📷
Binary file added images/apple.png
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 images/banana.png
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 images/broccoli.png
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 images/cabbage.png
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 images/carrot.png
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 images/cauliflower.png
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 images/favicon.png
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 images/guava.png
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 images/mango.png
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 images/tomato.png
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 images/watermelon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<link rel="icon" type="image/x-png" href="images/favicon.png">
<title>Let's Play the Game !!!</title>
</head>
<body>
<div class="screen">
<h2>Play with your Favorite Edible🎮</h2>
<button class="btn" id="start-btn">Play Game</button>
</div>

<div class="screen">
<h1>Choose your favorite Fruit</h1>
<ul class="lists">
<li>
<button class="choose-btn">
<p>Apple</p>
<img src="images/apple.png" alt="Apple">
</button>
</li>
<li>
<button class="choose-btn">
<p>Banana</p>
<img src="images/banana.png" alt="Banana"/>
</button>
</li>
<li>
<button class="choose-btn">
<p>Gauva</p>
<img src="images/guava.png" alt="Gauva"/>
</button>
</li>
<li>
<button class="choose-btn">
<p>Mango</p>
<img src="images/mango.png" alt="Mango"/>
</button>
</li>
<li>
<button class="choose-btn">
<p>Watermelon</p>
<img src="images/watermelon.png" alt="Watermelon"/>
</button>
</li>
</ul>

<h1>OR</h1>
<h1>Choose your favorite Vegetable to continue..</h1>
<ul class="lists">
<li>
<button class="choose-btn">
<p>Broccoli</p>
<img src="images/broccoli.png" alt="Broccoli">
</button>
</li>
<li>
<button class="choose-btn">
<p>Cabbage</p>
<img src="images/cabbage.png" alt="Cabbage"/>
</button>
</li>
<li>
<button class="choose-btn">
<p>Carrot</p>
<img src="images/carrot.png" alt="Carrot"/>
</button>
</li>
<li>
<button class="choose-btn">
<p>Cauliflower</p>
<img src="images/cauliflower.png" alt="Cauliflower"/>
</button>
</li>
<li>
<button class="choose-btn">
<p>Tomato</p>
<img src="images/tomato.png" alt="Tomato"/>
</button>
</li>
</ul>
</div>

<div class="screen game-container" id="game-container">
<h3 id="time" class="time">Time: 00:00</h3>
<h3 id="score" class="score">Score: 0</h3>
</div>

<script src="script.js"></script>
</body>
</html>
74 changes: 74 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const screens = document.querySelectorAll('.screen');
const choose_btns = document.querySelectorAll('.choose-btn');
const start_btn = document.getElementById('start-btn')
const game_container = document.getElementById('game-container')
const timeEl = document.getElementById('time')
const scoreEl = document.getElementById('score')
let seconds = 0
let score = 0
let selected_edible = {}

start_btn.addEventListener('click', () => screens[0].classList.add('up'))

choose_btns.forEach(btn => {
btn.addEventListener('click', () => {
const img = btn.querySelector('img')
const src = img.getAttribute('src')
const alt = img.getAttribute('alt')
selected_edible = { src, alt }
screens[1].classList.add('up')
setTimeout(createEdible, 1000)
startGame()
})
})

function startGame() {
setInterval(increaseTime, 1000)
}

function increaseTime() {
let m = Math.floor(seconds / 60)
let s = seconds % 60
m = m < 10 ? `0${m}` : m
s = s < 10 ? `0${s}` : s
timeEl.innerHTML = `Time: ${m}:${s}`
seconds++
}

function createEdible() {
const edible = document.createElement('div')
edible.classList.add('edible')
const { x, y } = getRandomLocation()
edible.style.top = `${y}px`
edible.style.left = `${x}px`
edible.innerHTML = `<img src="${selected_edible.src}" alt="${selected_edible.alt}" style="transform: rotate(${Math.random() * 360}deg)" />`

edible.addEventListener('click', catchEdible)

game_container.appendChild(edible)
}

function getRandomLocation() {
const width = window.innerWidth
const height = window.innerHeight
const x = Math.random() * (width - 200) + 100
const y = Math.random() * (height - 200) + 100
return { x, y }
}

function catchEdible() {
increaseScore()
this.classList.add('caught')
setTimeout(() => this.remove(), 2000)
addEdibles()
}

function addEdibles() {
setTimeout(createEdible, 1000)
setTimeout(createEdible, 1500)
}

function increaseScore() {
score++
scoreEl.innerHTML = `Score: ${score}`
}
Loading

0 comments on commit 94bd2bd

Please sign in to comment.