58 lines
1.8 KiB
Markdown
58 lines
1.8 KiB
Markdown
# 📱 Building NovaFarma for Android
|
|
|
|
This guide explains how to pack your NovaFarma game into an Android APK using **Capacitor**.
|
|
|
|
## Prerequisites
|
|
1. **Node.js** (Already installed)
|
|
2. **Android Studio** (Download and install from [developer.android.com](https://developer.android.com/studio))
|
|
- Ensure you install the **Android SDK** and create a **Virtual Device** (AVD) or enable USB debugging on your Android phone.
|
|
|
|
## Steps
|
|
|
|
### 1. Install Capacitor
|
|
In your project terminal (Game Folder), run:
|
|
```bash
|
|
npm install @capacitor/core @capacitor/cli @capacitor/android
|
|
```
|
|
|
|
### 2. Initialize Capacitor
|
|
Initialize the project config. Since your project serves files directly from the root:
|
|
```bash
|
|
npx cap init NovaFarma com.novafarma.game --web-dir .
|
|
```
|
|
|
|
### 3. Add Android Platform
|
|
This creates the native Android project folder.
|
|
```bash
|
|
npx cap add android
|
|
```
|
|
|
|
### 4. Sync Project
|
|
This copies your web assets (html, css, js) into the Android native project.
|
|
```bash
|
|
npx cap sync
|
|
```
|
|
|
|
### 5. Open in Android Studio
|
|
```bash
|
|
npx cap open android
|
|
```
|
|
This will launch Android Studio with your project loaded.
|
|
|
|
### 6. Run on Device
|
|
- Connect your Android phone via USB (Developer Mode enabled) OR start an Emulator in Android Studio.
|
|
- Click the green **Run (Play)** button in the top toolbar.
|
|
- The game should launch on your device!
|
|
|
|
### 7. Export APK (For Sharing)
|
|
To create a standalone file you can send to friends:
|
|
- Go to **Build > Build Bundle(s) / APK(s) > Build APK(s)**.
|
|
- Once finished, a notification will appear. Click "Locate" to find your `app-debug.apk`.
|
|
|
|
## 🎮 Mobile Controls
|
|
We have already enabled **Virtual Joystick** support in the `UIScene`.
|
|
- A joystick appears on the bottom-left of the screen.
|
|
- Use it to control the character without a keyboard!
|
|
|
|
Happy Slaying! 🧟📱
|