Skip to content

SamTheTechi/Magica

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Magica - A 2D RPG Adventure Game

Magica Banner

Magica is a 2D RPG adventure game built from scratch using vanilla JavaScript, HTML5 Canvas, and CSS. Explore a vast world, battle enemies, and uncover the secrets hidden within the realm of Magica!

โœจ Features

  • Dynamic Gameplay: Experience a classic 2D RPG with a top-down perspective, featuring a rich and interactive world.
  • Responsive Design: Play on any screen size, from desktops to mobile devices.
  • Pub/Sub Architecture: A robust event-driven system manages game logic, ensuring a modular and scalable codebase.
  • Expansive World: Explore over 20+ unique in-game locations, each with its own set of design and challenges.
  • Engaging Story: Immerse yourself in a captivating narrative with the quest.
  • Multiple Weapons: Choose from a variety of weapons to suit your playstyle (only one melee and range at a time).
  • Challenging Enemies: Face a diverse range of enemies, each with varing hitpoints and range.

๐ŸŽฎ Gameplay

  • Movement: Control the player using the WASD or arrow keys.
  • Combat: Attack enemies with your equipped weapon using the spacebar.
  • Heal: Heal characters hitpoints by pressing the "Z" key.
  • Swap Weapons: Use Shift to swap weapons form range to melee or vice-versa.

๐Ÿ› ๏ธ Tech Stack

  • JavaScript (ES6+): The core game logic is written in modern JavaScript.
  • HTML5 Canvas: Renders all graphics and animations.
  • CSS3: Styles the UI and game elements.
  • Vite: A fast and lightweight development server and build tool.
  • Bun: A modern JavaScript runtime and package manager.

๐Ÿ“‚ Project Structure

/
โ”œโ”€โ”€ public/ # Static assets (images, sounds, etc.)
โ”œโ”€โ”€ src/ # Source code
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ abjecentLists/ # contains map specific data 
โ”‚   โ”œโ”€โ”€ classes/ # Game object classes
โ”‚   โ”œโ”€โ”€ constants/ # Game constants (directions, health, etc.)
โ”‚   โ”œโ”€โ”€ meta/ # Infomation about game objects
โ”‚   โ”œโ”€โ”€ store/ # States
โ”‚   โ”œโ”€โ”€ ui/ # UI components
โ”‚   โ”œโ”€โ”€ util/ # Utility functions
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ main.js # Entry point
โ”‚   โ”œโ”€โ”€ eventListenera.js # All the pub/sub logic
โ”‚   โ”œโ”€โ”€ updateLoop.js # Game eventloop
โ”‚   โ”œโ”€โ”€ menu.js # Ui elements logic
โ”‚   โ””โ”€โ”€ declare.js # init objects
โ”‚
โ”œโ”€โ”€ index.html # Main HTML file
โ””โ”€โ”€ package.json # Project dependencies

๐Ÿš€ Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/SamTheTechi/magica.git
    cd magica
  2. Install dependencies:

    bun install # or npm install
  3. Start the Development Server:

    bun run dev # or bun run dev

Then open http://localhost:5173 in your browser.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

  • All assets used in this project are from itch.io.
  • The game is inspired by the classic "The Legend of Zelda" series.

Made with โค๏ธ by Sameer Gupta

About

2D open world rpg game build from scratch ๐Ÿ’–

Topics

Resources

License

Stars

Watchers

Forks