├── images
├── shop.png
├── kenji
│ ├── Run.png
│ ├── Death.png
│ ├── Fall.png
│ ├── Idle.png
│ ├── Jump.png
│ ├── Attack1.png
│ ├── Attack2.png
│ └── Take hit.png
├── background.png
└── samuraiMack
│ ├── Fall.png
│ ├── Idle.png
│ ├── Jump.png
│ ├── Run.png
│ ├── Attack1.png
│ ├── Attack2.png
│ ├── Death.png
│ ├── TakeHit.png
│ └── Take Hit - white silhouette.png
├── README.md
├── LICENSE.md
├── js
├── utilitis.js
└── classes.js
├── index.html
└── index.js
/images/shop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/shop.png
--------------------------------------------------------------------------------
/images/kenji/Run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Run.png
--------------------------------------------------------------------------------
/images/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/background.png
--------------------------------------------------------------------------------
/images/kenji/Death.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Death.png
--------------------------------------------------------------------------------
/images/kenji/Fall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Fall.png
--------------------------------------------------------------------------------
/images/kenji/Idle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Idle.png
--------------------------------------------------------------------------------
/images/kenji/Jump.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Jump.png
--------------------------------------------------------------------------------
/images/kenji/Attack1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Attack1.png
--------------------------------------------------------------------------------
/images/kenji/Attack2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Attack2.png
--------------------------------------------------------------------------------
/images/kenji/Take hit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/kenji/Take hit.png
--------------------------------------------------------------------------------
/images/samuraiMack/Fall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Fall.png
--------------------------------------------------------------------------------
/images/samuraiMack/Idle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Idle.png
--------------------------------------------------------------------------------
/images/samuraiMack/Jump.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Jump.png
--------------------------------------------------------------------------------
/images/samuraiMack/Run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Run.png
--------------------------------------------------------------------------------
/images/samuraiMack/Attack1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Attack1.png
--------------------------------------------------------------------------------
/images/samuraiMack/Attack2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Attack2.png
--------------------------------------------------------------------------------
/images/samuraiMack/Death.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Death.png
--------------------------------------------------------------------------------
/images/samuraiMack/TakeHit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/TakeHit.png
--------------------------------------------------------------------------------
/images/samuraiMack/Take Hit - white silhouette.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ELDADBRHANO/Fight-Game/HEAD/images/samuraiMack/Take Hit - white silhouette.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Fight-Game
2 | This is a game made with Canvas and HTML. The objective of the game is to defeat your opponent by reducing their health to zero.
3 |
4 | ### The left player controlled by : 'A' , 'S' , 'W' and for attack press space.
5 |
6 |
7 | ## How to Play
8 | The left player is controlled by the keys 'A' (move left), 'S' (crouch), 'W' (jump), and space (attack). The right player is controlled by the arrow keys 👉 (move right), 👈 (move left), 👆 (jump), and 👇 (attack).
9 |
10 | ## Hosting
11 | This game is hosted on Netlify. You can play it by clicking on the following link:
12 | ### https://eldadbrhano-fight-game.netlify.app/
13 |
14 |
15 | ## Future Improvements
16 | While the game is fully functional, there are still some improvements that could be made. These include:
17 |
18 | - Adding more levels
19 | - Adding sound effects
20 | - Adding a timer for each round
21 |
22 | ## Conclusion
23 | Thank you for playing Fight-Game! We hope you enjoyed it. If you have any feedback or suggestions, please don't hesitate to contact me.
24 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Eldad Brhano
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/js/utilitis.js:
--------------------------------------------------------------------------------
1 |
2 | function rectangularCollision({ rectangle1, rectangle2 }) {
3 | return (
4 | rectangle1.attackBox.position.x + rectangle1.attackBox.width >=
5 | rectangle2.position.x &&
6 | rectangle1.attackBox.position.x <=
7 | rectangle2.position.x + rectangle2.width &&
8 | rectangle1.attackBox.position.y + rectangle1.attackBox.height >=
9 | rectangle2.position.y &&
10 | rectangle1.attackBox.position.y <= rectangle2.position.y + rectangle2.height
11 | );
12 | }
13 |
14 | function announceWinner({player,enemy,timerId}) {
15 | clearTimeout(timerId)
16 | document.getElementById('displayText').style.display='flex'
17 | if(player.health === enemy.health){
18 | document.getElementById('displayText').innerHTML='Tie'
19 | }else if(player.health > enemy.health){
20 | document.getElementById('displayText').innerHTML='Player 1 wins'
21 | }else if(player.health < enemy.health){
22 | document.getElementById('displayText').innerHTML='player 2 wins'
23 | }
24 | }
25 |
26 | let timer = 60;
27 | let timerId;
28 | function decreaseTimer() {
29 | if (timer > 0) {
30 | timerId = setTimeout(decreaseTimer, 1000);
31 | timer--
32 | document.getElementById('timer').innerHTML = timer;
33 | };
34 |
35 | if(timer===0){
36 | announceWinner({player,enemy})
37 | }
38 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |