Skip to content

Commit ac84415

Browse files
authored
Merge pull request #11 from Sybit-Education/feature/buttons
Added controller and keyboard navigation support
2 parents be7bed3 + 985b428 commit ac84415

25 files changed

+2756
-542
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
vite/
4+
public/assets/

.eslintrc.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: [
5+
'@typescript-eslint'
6+
],
7+
extends: [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/recommended'
10+
],
11+
rules: {
12+
// Phaser specific rules
13+
'@typescript-eslint/no-explicit-any': 'warn',
14+
'@typescript-eslint/explicit-function-return-type': 'off',
15+
'@typescript-eslint/no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
16+
17+
// Game development often needs these
18+
'no-case-declarations': 'off',
19+
'prefer-const': 'warn',
20+
21+
// Formatting
22+
'semi': ['error', 'always'],
23+
'quotes': ['warn', 'single', { 'allowTemplateLiterals': true }]
24+
},
25+
env: {
26+
browser: true,
27+
es6: true
28+
},
29+
parserOptions: {
30+
ecmaVersion: 2020,
31+
sourceType: 'module'
32+
},
33+
ignorePatterns: ['dist/**/*', 'node_modules/**/*']
34+
};

.eslintrc.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"parser": "@typescript-eslint/parser",
13+
"parserOptions": {
14+
"ecmaVersion": "latest",
15+
"sourceType": "module",
16+
"project": "./tsconfig.json"
17+
},
18+
"plugins": [
19+
"@typescript-eslint"
20+
],
21+
"rules": {
22+
"no-console": ["warn", { "allow": ["warn", "error"] }],
23+
"@typescript-eslint/explicit-function-return-type": "off",
24+
"@typescript-eslint/no-explicit-any": "warn",
25+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }]
26+
},
27+
"ignorePatterns": [
28+
"dist",
29+
"node_modules",
30+
"vite"
31+
]
32+
}

README.md

Lines changed: 64 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,71 @@
1-
# Azubi Game-Challenge 2025
1+
# Azubi-Game-Challenge 2025
22

3-
Challenge to create first game in team
3+
### Herausforderung: Das erste Spiel in einem Team erstellen
44

5-
🎯 **Goal:** Entwickelt gemeinsam ein **lokales Multiplayer-Spiel mit Phaser 3**, das wir an der Weihnachtsfeier zocken können.
5+
🎯 **Goal:** Entwickelt gemeinsam ein **Multiplayer-Spiel mit Phaser 3**, das wir an der Weihnachtsfeier zocken können.
66

77
---
88

99
## 🏆 Anforderungen
1010

11-
- **Technologie:** [Phaser 3](https://phaser.io/) + TypeScript
12-
- **Laufzeit:** Spiel läuft im Browser (Chrome/Edge, Vollbild/Kiosk möglich)
13-
- **Spielidee:** frei wählbar (Winter-/Weihnachtsthema ist ein Bonus 🎅)
14-
- **Spielbar:** Single-Play oder **2 Spieler** (Tastatur oder Gamepads)
15-
- **Scope:** lieber **klein, aber spielbar** als zu groß gedacht und unfertig
16-
- **Deadline:** erste Demo nach **14 Tagen** (zeigt uns, was ihr habt!)
11+
- **Technologie:** [Phaser 3](https://phaser.io/) + TypeScript
12+
- **Laufzeit:** Spiel läuft im Browser (Chrome/Edge, Vollbild/Kiosk möglich)
13+
- **Spielidee:** frei wählbar (Winter-/Weihnachtsthema ist ein Bonus 🎅)
14+
- **Spielbar:** Single-Play oder **2 Spieler** (Tastatur oder Gamepads)
15+
- **Scope:** lieber **klein, aber spielbar** als zu groß gedacht und unfertig
16+
- **Deadline:** erste Demo nach **14 Tagen** (zeigt uns, was ihr habt!)
1717

1818
---
1919

2020
## 📚 Tutorials & Lernmaterial
2121

22-
- **Phaser 3 Getting Started:**
23-
- [Getting Started with Phaser 3](https://phaser.io/tutorials/getting-started-phaser3)
24-
- [Making your first Phaser 3 game](https://phaser.io/tutorials/making-your-first-phaser-3-game)
25-
- [Phaser API Documentation](https://docs.phaser.io/api-documentation/api-documentation)
26-
- **Phaser Examples (offizielle Sammlung):**
27-
[Phaser Examples](https://phaser.io/examples)
28-
- **TypeScript + Vite Starter Template:**
29-
[phaser-vite-template](https://github.com/phaserjs/template-vite-ts)
30-
Dieses Template ist Basis für dieses Repository.
31-
- **Gamepad-API (für Controller):**
32-
[MDN – Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API)
22+
- [Getting Started with Phaser 3](https://phaser.io/tutorials/getting-started-phaser3)
23+
- [Making your first Phaser 3 game](https://phaser.io/tutorials/making-your-first-phaser-3-game)
24+
- [Phaser API Documentation](https://docs.phaser.io/api-documentation/api-documentation)
25+
- [Phaser Examples](https://phaser.io/examples)
26+
- [Helpful idk](https://rexrainbow.github.io/phaser3-rex-notes/docs/site/)
27+
- [phaser-vite-typescript-template](https://github.com/phaserjs/template-vite-ts) (Dieses Template ist Basis für dieses Repository.)
28+
- [MDN – Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API)
3329

34-
👉 Tipp: Arbeitet die Tutorials **gemeinsam** durch und überlegt, was ihr davon für euer Spiel übernehmen könnt.
35-
36-
## 💡 Tipps für die ersten 14 Tage
37-
38-
- **Team aufteilen:**
39-
- Gameplay / Spiellogik
40-
- Grafiken & Sprites
41-
- UI (Menüs, Score-Anzeige)
42-
- Testen & Balancing
43-
- Projektorganisation (Repo, Issues, Dokumentation)
44-
- Sound & Musik (optional, aber macht Stimmung 🎶)
45-
46-
- **Klein anfangen:**
47-
- Bewegung + Kollision
48-
- Punkte zählen
49-
- Runde beenden / Neustart
50-
51-
- **Erst die Basis, dann Features:**
52-
Wenn die Spielfigur sich bewegen kann und ein einfaches Ziel hat → **erst mal committen und pushen!**
53-
54-
- **Versionieren:**
55-
Nutzt GitHub/GitLab (Branches, Commits, Pull Requests).
56-
Auch halbfertige Ideen sind besser im Repo als nur auf einem Laptop.
57-
58-
59-
## 📂 Repo-Aufbau (Vorschlag)
30+
## 📂 Repo-Aufbau
6031

6132
```sh
6233
/README.md → diese Datei
6334
/package.json → Dependencies (npm/yarn/pnpm)
6435
/public
65-
/assets
66-
/sprites → Grafiken, Figuren, Hintergründe
67-
/sounds → Soundeffekte & Musik
36+
/background -> Hintergründe
37+
/hud -> UI Elemente & Buttons
38+
/sound -> Musik
39+
/sprites -> Bilder für Spieler und "Gegner"
6840
/src
69-
/scenes → verschiedene Spiel-Szenen (Menu, Game, GameOver, …)
70-
41+
/custom_classes -> Wiederverwendbare Klassen
42+
/loader -> Loader von Texturen und Sounds
43+
/scenes -> Game-Scenen
44+
/thatFolder -> Haupt Ordner für Logik
7145
```
7246

73-
👉 Szenen-Aufteilung in Phaser ist Standard:
74-
- **Boot/Preload:** lädt Assets
75-
- **Menu:** Startmenü, Einstellungen
76-
- **Game:** eigentliche Spiel-Logik
77-
- **GameOver/Results:** Scores, Neustart-Option
78-
79-
---
80-
81-
## ✅ Nächste Schritte
82-
83-
1. Repo clonen & Template starten (Phaser + Vite).
84-
2. Ein einfaches **Sprite** laden und auf Pfeiltasten bewegen.
85-
3. Git-Workflow absprechen (wer arbeitet woran?).
86-
4. Ergebnisse **nach 14 Tagen** präsentieren – es muss Hauptsache spielbar sein!
8747

88-
---
89-
90-
Viel Erfolg & viel Spaß beim Coden 🚀
91-
**Euer Ziel ist nicht Perfektion – sondern ein gemeinsames Spiel, das Freude macht!**
92-
93-
---
94-
95-
## Development
96-
97-
This is a Phaser 3 project basing on template that uses Vite for bundling. It supports hot-reloading for quick development workflow, includes TypeScript support and scripts to generate production-ready builds.
98-
99-
100-
### Requirements
48+
## ⚙️ Requirements
10149

10250
[Node.js](https://nodejs.org) is required to install dependencies and run scripts via `npm`.
10351

104-
### Available Commands
52+
## 💻 Available Commands
10553

106-
| Command | Description |
107-
|---------|-------------|
108-
| `npm install` | Install project dependencies |
109-
| `npm run dev` | Launch a development web server |
110-
| `npm run build` | Create a production build in the `dist` folder |
111-
| `npm run dev-nolog` | Launch a development web server without sending anonymous data (see "About log.js" below) |
54+
| Command | Description |
55+
|-----------------------|----------------------------------------------------------------------------------------------------------|
56+
| `npm install` | Install project dependencies |
57+
| `npm run dev` | Launch a development web server |
58+
| `npm run build` | Create a production build in the `dist` folder |
59+
| `npm run dev-nolog` | Launch a development web server without sending anonymous data (see "About log.js" below) |
11260
| `npm run build-nolog` | Create a production build in the `dist` folder without sending anonymous data (see "About log.js" below) |
11361

11462
### Writing Code
11563

11664
After cloning the repo, run `npm install` from your project directory. Then, you can start the local development server by running `npm run dev`.
11765

118-
The local development server runs on `http://localhost:8080` by default. Please see the Vite documentation if you wish to change this, or add SSL support.
66+
The local development server runs on `http://localhost:8080` by default. Please see the Vite documentation if you wish to change this or add SSL support.
11967

120-
Once the server is running you can edit any of the files in the `src` folder. Vite will automatically recompile your code and then reload the browser.
68+
Once the server is running, you can edit any of the files in the `src` folder. Vite will automatically recompile your code and then reload the browser.
12169

12270
### Template Project Structure
12371

@@ -127,16 +75,15 @@ We have provided a default project structure to get you started. This is as foll
12775

12876
We have provided a default project structure to get you started:
12977

130-
| Path | Description |
131-
|------------------------------|------------------------------------------------------------|
132-
| `index.html` | A basic HTML page to contain the game. |
133-
| `public/assets` | Game sprites, audio, etc. Served directly at runtime. |
134-
| `public/style.css` | Global layout styles. |
135-
| `src/main.ts` | Application bootstrap. |
136-
| `src/game` | Folder containing the game code. |
137-
| `src/game/main.ts` | Game entry point: configures and starts the game. |
138-
| `src/game/scenes` | Folder with all Phaser game scenes. |
139-
78+
| Path | Description |
79+
|--------------------|-------------------------------------------------------|
80+
| `index.html` | A basic HTML page to contain the game. |
81+
| `public/assets` | Game sprites, audio, etc. Served directly at runtime. |
82+
| `public/style.css` | Global layout styles. |
83+
| `src/main.ts` | Application bootstrap. |
84+
| `src/game` | Folder containing the game code. |
85+
| `src/game/main.ts` | Game entry point: configures and starts the game. |
86+
| `src/game/scenes` | Folder with all Phaser game scenes. |
14087

14188
### Handling Assets
14289

@@ -148,44 +95,43 @@ This template provides support for both embedding assets and also loading them f
14895
import logoImg from './assets/logo.png'
14996
```
15097

151-
To load static files such as audio files, videos, etc place them into the `public/assets` folder. Then you can use this path in the Loader calls within Phaser:
98+
To load static files such as audio files, videos, etc. place them into the `public/assets` folder. Then you can use this path in the Loader calls within Phaser:
15299

153100
```js
154-
preload ()
155-
{
156-
// This is an example of an imported bundled image.
157-
// Remember to import it at the top of this file
158-
this.load.image('logo', logoImg);
159-
160-
// This is an example of loading a static image
161-
// from the public/assets folder:
162-
this.load.image('background', 'assets/bg.png');
101+
preload() {
102+
// This is an example of an imported bundled image.
103+
// Remember to import it at the top of this file
104+
this.load.image('logo', logoImg);
105+
106+
// This is an example of loading a static image
107+
// from the public/assets folder:
108+
this.load.image('background', 'assets/bg.png');
163109
}
164110
```
165111

166112
When you issue the `npm run build` command, all static assets are automatically copied to the `dist/assets` folder.
167113

168114
### Deploying to Production
169115

170-
After you run the `npm run build` command, your code will be built into a single bundle and saved to the `dist` folder, along with any other assets your project imported, or stored in the public assets folder.
116+
After you run the `npm run build` command, your code will be built into a single bundle and saved to the `dist` folder, along with any other assets your project imported, or stored in the public asset's folder.
171117

172-
In order to deploy your game, you will need to upload *all* of the contents of the `dist` folder to a public facing web server.
118+
To deploy your game, you will need to upload *all* the contents of the `dist` folder to a public-facing web server.
173119

174120
### Customizing the Template
175121

176122
#### Vite
177123

178-
If you want to customize your build, such as adding plugin (i.e. for loading CSS or fonts), you can modify the `vite/config.*.mjs` file for cross-project changes, or you can modify and/or create new configuration files and target them in specific npm tasks inside of `package.json`. Please see the [Vite documentation](https://vitejs.dev/) for more information.
124+
If you want to customize your build, such as adding plugin (i.e., for loading CSS or fonts), you can modify the `vite/config.*.mjs` file for cross-project changes, or you can modify and/or create new configuration files and target them in specific npm tasks inside of `package.json`. Please see the [Vite documentation](https://vitejs.dev/) for more information.
179125

180126
### About log.js
181127

182-
If you inspect our node scripts you will see there is a file called `log.js`. This file makes a single silent API call to a domain called `gryzor.co`. This domain is owned by Phaser Studio Inc. The domain name is a homage to one of our favorite retro games.
128+
If you inspect our node scripts, you will see there is a file called `log.js`. This file makes a single silent API call to a domain called `gryzor.co`. This domain is owned by Phaser Studio Inc. The domain name is homage to one of our favorite retro games.
183129

184-
We send the following 3 pieces of data to this API: The name of the template being used (vue, react, etc). If the build was 'dev' or 'prod' and finally the version of Phaser being used.
130+
We send the following 3 pieces of data to this API: The name of the template being used (vue, react, etc.). If the build was 'dev' or 'prod' and finally the version of Phaser being used.
185131

186132
At no point is any personal data collected or sent. We don't know about your project files, device, browser or anything else. Feel free to inspect the `log.js` file to confirm this.
187133

188-
Why do we do this? Because being open source means we have no visible metrics about which of our templates are being used. We work hard to maintain a large and diverse set of templates for Phaser developers and this is our small anonymous way to determine if that work is actually paying off, or not. In short, it helps us ensure we're building the tools for you.
134+
Why do we do this? Because being open source means we have no visible metrics about which of our templates are being used. We work hard to maintain a large and diverse set of templates for Phaser developers, and this is our small anonymous way to determine if that work is actually paying off, or not. In short, it helps us ensure we're building the tools for you.
189135

190136
However, if you don't want to send any data, you can use these commands instead:
191137

@@ -201,39 +147,28 @@ Build:
201147
npm run build-nolog
202148
```
203149

204-
Or, to disable the log entirely, simply delete the file `log.js` and remove the call to it in the `scripts` section of `package.json`:
150+
Or, to disable the log entirely, delete the file `log.js` and remove the call to it in the `scripts` section of `package.json`:
205151

206152
Before:
207153

208154
```json
209155
"scripts": {
210-
"dev": "node log.js dev & dev-template-script",
211-
"build": "node log.js build & build-template-script"
156+
"dev": "node log.js dev & dev-template-script",
157+
"build": "node log.js build & build-template-script"
212158
},
213159
```
214160

215161
After:
216162

217163
```json
218164
"scripts": {
219-
"dev": "dev-template-script",
220-
"build": "build-template-script"
165+
"dev": "dev-template-script",
166+
"build": "build-template-script"
221167
},
222168
```
223169

224170
Either of these will stop `log.js` from running. If you do decide to do this, please could you at least join our Discord and tell us which template you're using! Or send us a quick email. Either will be super-helpful, thank you.
225171

226-
## Join the Phaser Community!
227-
228-
We love to see what developers like you create with Phaser! It really motivates us to keep improving. So please join our community and show-off your work 😄
229-
230-
**Visit:** The [Phaser website](https://phaser.io) and follow on [Phaser Twitter](https://twitter.com/phaser_)<br />
231-
**Play:** Some of the amazing games [#madewithphaser](https://twitter.com/search?q=%23madewithphaser&src=typed_query&f=live)<br />
232-
**Learn:** [API Docs](https://newdocs.phaser.io), [Support Forum](https://phaser.discourse.group/) and [StackOverflow](https://stackoverflow.com/questions/tagged/phaser-framework)<br />
233-
**Discord:** Join us on [Discord](https://discord.gg/phaser)<br />
234-
**Code:** 2000+ [Examples](https://labs.phaser.io)<br />
235-
**Read:** The [Phaser World](https://phaser.io/community/newsletter) Newsletter<br />
236-
237172
## License
238173

239174
The Phaser logo and characters are &copy; 2011 - 2025 Phaser Studio Inc. All rights reserved.

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8"/>
5-
<link rel="icon" type="image/png" href="./public/favicon.png"/>
5+
<link rel="icon" type="image/png" href="/favicon.png"/>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7-
<link rel="stylesheet" href="./public/style.css">
7+
<link rel="stylesheet" href="/style.css">
88
<title>SyRun - Phaser 3</title>
99
</head>
1010

0 commit comments

Comments
 (0)