❓Why the page is not loading❓
Due to usage of PHP and MySQL for saving the best scores I had to use hosting with support for this technology. I have no money so I used a free hosting which unfortunately puts websites to sleep. Juts wait a few minutes and it should work.❓Why sounds starts playing after first click and not when I open the page❓
It's because auto playing sounds is blocked by browser until the user interact with the document.❓Why my commits often have no names and I'm not using branches❓
- I often create with bursts many things at once
- I don't plan things ahead, I just create things that seems good at that moment
- Sometimes I have bad internet connection and it is troublesome to send commits
- I'm coding alone so creating branches and describing commits is not useful for me
Deer Killer is an arcade racing game with the goal to get as many points as possible in one attempt by killing deers and avoiding cars.
See live demo.
Languages:
- HTML
- CSS
- JS
- PHP
Programs:
- Menu starting animation
- Mute/unmute sound
- Menu windows with transitions
- Credits window
- Four levels of difficulty
- Personal and general top 10 leaderboards for each difficulty
- Countdown on game start
- Spawning enemies that can hit players
- Spawning deers that can be hit by enemy or player giving him points
- Three lives for player
- Explosion animation of enemy when it is hit by a player
- Short time protection when enemy hit the player
- Energy points for using slow motion skill
- Points counter
- Player slip and laughing deers animations when player loses all their lives
- Game over screen and game restart without reloading the page
Note
Room for improvements:
- Ability to stop slowmo skill after atleast 1s (now it runs until it uses up all the energy)
- Probably rewriting the code (it's an improved version of my old school project and the code is very messy)
- Fixing some problems:
- Game gets faster or slower depending on device framerate
- Sometimes the game starts lagging for few seconds and then again goes smoothly
- Sometimes on laughing deers animation, the deer next to player's car starts blinking
Ways to run this program:
- Use the live demo
- Follow the same steps as for editing the program
To edit this program:
- Download this repo
- Download XAMPP
- Run Apache and MySQL in XAMPP Control Panel
- Move the project to XAMPP's htdocs folder
- Open phpMyAdmin
- Click on Import tab
- Choose deerkiller.sql file from PHP folder in project
- Click import button at the bottom of the page
- Open localhost and open folder that you previously moved to htdocs
- Start coding
- Car crush
- Car explosion
- Tires screech
- Car crash on tree
- Points count
- Deer laugh 1
- Deer laugh 2
- Deer laugh 3
- Deer laugh 4
- Deer laugh 4
This section is a general description of the project required to understand how it works, the exact details are in the code or simply are the code.
The project directory tree looks like this:
- 📁 DeerKiller (project folder)
- 📄 github config
- 📄 readme file
- 📄 index.html file
- 📁 _for_readme - 📄 files for readme
- 📁 Sounds - 📄 sounds and music used in project
- 📁 Images
- 📁 UI - 📄 images for user interface
- 📁 Game - 📄 images used in the game
- 📁 PHP
- 📄 mysql database file
- 📄 php files for saving and getting the score
- 📁 Scripts
- 📁 Menu - 📄 scripts for menu
- 📁 Game
- 📄 scripts for game
- 📁 UI - 📄 scripts for user interface in game
- 📁 Styles
- 📄 css files
- 📁 fonts - 📄 fonts used in the project
Warning
Classes must be loaded from bottom to the top to avoid situation when class does not exist in the time of its objects creation
Menu is entry of the program.
Menu creates and manages one instance of each of the classes:
- MenuWindow (Credits)
- Difficulty
- TopScore
- Game
Difficulty and TopScore classes are extension of MenuWindow class which is responsible for showing and hiding menu window with transition
Game class creates and manages:
- One instance of RoadBackground class
- Two instances of treesBackground class (left and right side)
- One instance of classes:
- HealthBar
- EnergyBar
- PointsCounter
- GameOver
- One instance of Player class
- Many instances of classes:
- Enemy
- Deer
- HappyDeer