Skip to content

Commit 7db8681

Browse files
author
kalypsohoman
committed
init
0 parents  commit 7db8681

30 files changed

Lines changed: 910 additions & 0 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "\U0001f41e New Bug"
2+
description: Raise up bug report
3+
4+
title: 'your-bug'
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
_Thank you for reporting this bug_
11+
12+
- type: textarea
13+
id: repro
14+
attributes:
15+
label: '<h2>Repro Steps</h2>'
16+
description: Please provide steps to reproduce the **BUG**
17+
placeholder: Click on xyc > scroll to abc section > click on zzz > see error
18+
validations:
19+
required: true
20+
21+
- type: textarea
22+
id: solution
23+
attributes:
24+
label: '<h2>Acceptance Criteria</h2>'
25+
description: Try to provide an EXAMPLE or CONCEPT of the desirable and expected results
26+
placeholder: Performing x, y, & z will... should yield...
27+
validations:
28+
required: true
29+
30+
- type: textarea
31+
id: references
32+
attributes:
33+
label: '<h2>References</h2>'
34+
description: Please provide any **SCREENSHOTS**, **CODE SNIPPETS** or **LINKS** to the codebase or documentation which will help implement a solution.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "\U0001F4A1 New Issue"
2+
description: Suggest a new task
3+
4+
title: 'your-issue'
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
_Thank you for taking the time to propose a new idea_
11+
12+
- type: textarea
13+
id: issue
14+
attributes:
15+
label: '<h2>Describe the Issue</h2>'
16+
description: Please provide a short user story **DESCRIPTION** of the **ISSUE**
17+
placeholder: As a user I...
18+
validations:
19+
required: true
20+
21+
- type: textarea
22+
id: solution
23+
attributes:
24+
label: '<h2>Describe the Proposed Solution</h2>'
25+
description: Try to provide an EXAMPLE or CONCEPT of a design pattern that will lead to a SOLUTION
26+
placeholder: Implementing x, y, & z will...
27+
validations:
28+
required: true
29+
30+
- type: textarea
31+
id: references
32+
attributes:
33+
label: '<h2>References</h2>'
34+
description: Please provide any **SCREENSHOTS**, **CODE SNIPPETS** or **LINKS** to the codebase or documentation which will help implement a solution.

.github/pull_request_template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 🍠 Summary
2+
3+
- Write summary here. Or don't.
4+
- Please remember to move your ticket to done!
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Auto Merge Bridge Branch to Main
2+
3+
on:
4+
push:
5+
branches:
6+
- assets
7+
8+
jobs:
9+
merge-to-main:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
# this ensures all histories are fetched for runner, avoiding `unrelated histories` merge error
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Merge to main
20+
# GH actions/checkout requires git identity to be configured for security, top two commands handle that
21+
run: |
22+
git config user.name "${{ github.actor }}"
23+
git config user.email "${{ github.actor }}@users.noreply.github.com"
24+
25+
git fetch origin
26+
git checkout main
27+
git merge --no-ff -m "auto merge bridge changes to main" ${{ github.ref }}
28+
git push origin main
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Auto Sync bridge-branch with main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
sync-with-main:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
# this ensures all histories are fetched for runner, avoiding `unrelated histories` merge error
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Merge changes into sprite-branch
20+
# GH actions/checkout requires git identity to be configured for security, top two commands handle that
21+
run: |
22+
git config user.name "${{ github.actor }}"
23+
git config user.email "${{ github.actor }}@users.noreply.github.com"
24+
git config pull.rebase false
25+
26+
git fetch origin
27+
git checkout assets
28+
git pull origin main
29+
git merge --no-ff -m "auto sync main changes to bridge branch" main
30+
31+
git push origin assets

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
/npm-debug.log
6+
yarn-debug.log*
7+
yarn-error.log*
8+
pnpm-debug.log*
9+
lerna-debug.log*
10+
11+
*.local
12+
plugins/spine*/spine-runtimes/
13+
14+
# Editor directories and files
15+
.vscode/*
16+
!.vscode/extensions.json
17+
.idea
18+
.DS_Store
19+
*.suo
20+
*.ntvs*
21+
*.njsproj
22+
*.sln
23+
*.sw?
24+
Thumbs.db
25+
*.sublime-project
26+
*.sublime-workspace
27+
28+
# Vendors
29+
node_modules/
30+
package-lock.json
31+
32+
# Build
33+
build/
34+
out/
35+
dist
36+
dist-ssr
37+
scripts/tsgen/test/bin/
38+
scripts/tsgen/test/output.txt

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Phaser Studio Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Phaser Vite TypeScript Template
2+
3+
## Table Of Contents
4+
- [Project Structure](#project-structure)
5+
- [Versions](#versions)
6+
- [Requirements](#requirements)
7+
- [Available Commands](#available-commands)
8+
- [Writing Code](#writing-code)
9+
- [Template Project Structure](#template-project-structure)
10+
- [Handling Assets](#handling-assets)
11+
- [Deploying to Production](#deploying-to-production)
12+
- [Customizing the Template](#customizing-the-template)
13+
- [Vite](#vite)
14+
- [About log.js](#about-logjs)
15+
- [Join the Phaser Community!](#join-the-phaser-community)
16+
17+
18+
This is a Phaser 3 project template that uses Vite for bundling. It supports hot-reloading for quick development workflow, includes TypeScript support and scripts to generate production-ready builds. It is a fork off of (the official Phaser Template)[https://github.com/phaserjs/template-webpack-ts] made by FrontEndParty for grab and go game jams.
19+
20+
## Template Project Structure
21+
```
22+
phase-game-template/
23+
24+
├── public/ # Static files to be served (optional, for hosting)
25+
| ├── assets/ # Static assets (images, audio, spritesheets, etc.)
26+
│ │ ├── audio/
27+
│ │ ├── fonts/
28+
│ │ ├── images/
29+
│ │ └── tilemaps/
30+
│ └── style.css
31+
32+
└── src/ # Source code
33+
├── config/ # Game configuration files
34+
|
35+
├── objects/ # Custom game objects or prefabs
36+
37+
├── plugins/ # Game plugins
38+
39+
├── scenes/ # All Phaser scenes (boot, preload, menu, game, etc.)
40+
41+
├── systems/ # Logic systems like input, physics, or game state
42+
43+
├── utils/ # Utility functions or constants
44+
45+
└── main.js # Game entry point (new Phaser.Game)
46+
```
47+
48+
## Versions
49+
50+
This template has been updated for:
51+
52+
- [Phaser 3.88.2](https://github.com/phaserjs/phaser)
53+
- [Vite 5.3.1](https://github.com/vitejs/vite)
54+
- [TypeScript 5.4.5](https://github.com/microsoft/TypeScript)
55+
56+
57+
## Requirements
58+
59+
[Node.js](https://nodejs.org) is required to install dependencies and run scripts via `npm`.
60+
61+
## Available Commands
62+
63+
| Command | Description |
64+
|---------|-------------|
65+
| `npm install` | Install project dependencies |
66+
| `npm run dev` | Launch a development web server |
67+
| `npm run build` | Create a production build in the `dist` folder |
68+
| `npm run dev-nolog` | Launch a development web server without sending anonymous data (see "About log.js" below) |
69+
| `npm run build-nolog` | Create a production build in the `dist` folder without sending anonymous data (see "About log.js" below) |
70+
71+
## Writing Code
72+
73+
After cloning the repo, run `npm install` from your project directory. Then, you can start the local development server by running `npm run dev`.
74+
75+
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.
76+
77+
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.
78+
79+
## Handling Assets
80+
81+
Vite supports loading assets via JavaScript module `import` statements.
82+
83+
This template provides support for both embedding assets and also loading them from a static folder. To embed an asset, you can import it at the top of the JavaScript file you are using it in:
84+
85+
```js
86+
import logoImg from './assets/images/logo.png'
87+
```
88+
89+
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:
90+
91+
```js
92+
preload ()
93+
{
94+
// This is an example of an imported bundled image.
95+
// Remember to import it at the top of this file
96+
this.load.image('logo', logoImg);
97+
98+
// This is an example of loading a static image
99+
// from the public/assets folder:
100+
this.load.image('background', 'assets/images/bg.png');
101+
}
102+
```
103+
104+
When you issue the `npm run build` command, all static assets are automatically copied to the `dist/assets` folder.
105+
106+
## Deploying to Production
107+
108+
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.
109+
110+
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.
111+
112+
## Customizing the Template
113+
114+
### Vite
115+
116+
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.
117+
118+
## About log.js
119+
120+
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.
121+
122+
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.
123+
124+
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.
125+
126+
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.
127+
128+
However, if you don't want to send any data, you can use these commands instead:
129+
130+
Dev:
131+
132+
```bash
133+
npm run dev-nolog
134+
```
135+
136+
Build:
137+
138+
```bash
139+
npm run build-nolog
140+
```
141+
142+
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`:
143+
144+
Before:
145+
146+
```json
147+
"scripts": {
148+
"dev": "node log.js dev & dev-template-script",
149+
"build": "node log.js build & build-template-script"
150+
},
151+
```
152+
153+
After:
154+
155+
```json
156+
"scripts": {
157+
"dev": "dev-template-script",
158+
"build": "build-template-script"
159+
},
160+
```
161+
162+
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.
163+
164+
## Join the Phaser Community!
165+
166+
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 😄
167+
168+
**Visit:** The [Phaser website](https://phaser.io) and follow on [Phaser Twitter](https://twitter.com/phaser_)<br />
169+
**Play:** Some of the amazing games [#madewithphaser](https://twitter.com/search?q=%23madewithphaser&src=typed_query&f=live)<br />
170+
**Learn:** [API Docs](https://newdocs.phaser.io), [Support Forum](https://phaser.discourse.group/) and [StackOverflow](https://stackoverflow.com/questions/tagged/phaser-framework)<br />
171+
**Discord:** Join us on [Discord](https://discord.gg/phaser)<br />
172+
**Code:** 2000+ [Examples](https://labs.phaser.io)<br />
173+
**Read:** The [Phaser World](https://phaser.io/community/newsletter) Newsletter<br />
174+
175+
Created by [Phaser Studio](mailto:support@phaser.io). Powered by coffee, anime, pixels and love.
176+
177+
The Phaser logo and characters are &copy; 2011 - 2024 Phaser Studio Inc.
178+
179+
All rights reserved.

0 commit comments

Comments
 (0)