Welcome to Dragon Repeller, a text-based RPG game where you must defeat the dragon that is preventing people from leaving the town. This project was created as part of the FreeCodeCamp curriculum for the JavaScript Algorithms and Data Structures certification.
JavaScript is a powerful scripting language that you can use to make web pages interactive. It's one of the core technologies of the web, along with HTML and CSS. All modern browsers support JavaScript.
In this practice project, you'll learn fundamental programming concepts in JavaScript by coding your own Role Playing Game. You'll learn how to work with arrays, strings, objects, functions, loops, if/else statements, and more.
In Dragon Repeller, you navigate through different locations, fight monsters, manage your resources, and ultimately aim to defeat the dragon. The game is controlled using three buttons that allow you to make decisions and take actions.
You begin the game in the town square with the following initial stats:
- XP: 0
- Health: 100
- Gold: 50
- Weapon: Stick
-
Town Square: The starting point of your adventure.
- Options: Go to store, Go to cave, Fight dragon
-
Store: Buy health or weapons.
- Options: Buy 10 health (10 gold), Buy weapon (30 gold), Go to town square
-
Cave: Fight different monsters.
- Options: Fight slime, Fight fanged beast, Go to town square
- Buy Health: Purchase 10 health points for 10 gold.
- Buy Weapon: Purchase a new weapon for 30 gold (if available).
- Sell Weapon: Sell your current weapon for 15 gold (if you have more than one weapon).
- Fight Monsters: Engage in combat with different monsters (slime, fanged beast, dragon).
- Attack: Attack the monster with your current weapon.
- Dodge: Attempt to dodge the monster's attack.
- Run: Escape the fight and return to the town square.
- Easter Egg Game: Guess a number and see if it matches one of the randomly chosen numbers to win gold or lose health.
- index.html: The main HTML file that contains the structure of the game.
- styles.css: The CSS file that styles the game.
- script.js: The JavaScript file that adds functionality to the game.
By completing this project, you will:
- Gain a deeper understanding of fundamental programming concepts in JavaScript.
- Learn how to work with arrays, strings, objects, functions, loops, and if/else statements.
- Understand how to manage game state and user interactions.
- Learn how to dynamically update the user interface based on the current state.
This project is part of the freeCodeCamp curriculum. For more information, visit freeCodeCamp.