Skip to content

Commit

Permalink
Merge pull request #47 from AllanCerveaux/develop
Browse files Browse the repository at this point in the history
Try GithubAction and fix some bug
  • Loading branch information
AllanCerveaux committed Feb 17, 2024
2 parents 642a14d + 4b23c7a commit a6afa6a
Show file tree
Hide file tree
Showing 20 changed files with 303 additions and 173 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

### Developer Notes

`Procedural-Dungeon` is developed using Typescript and Node.js 6.12 or >, so you shouldn't run into issues testing the repository on later versions.
`Procedural-Dungeon` is developed using Typescript and Node.js 20.X or >, so you shouldn't run into issues testing the repository on later versions.

#### Setup

Expand All @@ -28,8 +28,8 @@ That's all there is to it for setup project.

#### Keep In Mind

- **Follow the coding** conventions. Run `yarn xo` to spot linting problems early.
- **Avoid making changes directly on** `master`, **use topic branches instead**. Use `git checkout [feature||fix]/[feature_name]` (of course, replacing `feature-branch` with a name you feel more appropriate), edit and commit your changes there (start your commit with `FEATURE` for new feature, `FIX` if resolve problem, `WIP` if not finish your job ...). Run `git push` when you're done.
- **Follow the coding** conventions. Run `pnpm xo` to spot linting problems early.
- **Avoid making changes directly on** `main`, **use topic branches instead**. Use `git checkout [feature||fix]/[feature_name]` (of course, replacing `feature-branch` with a name you feel more appropriate), edit and commit your changes there (start your commit with `FEATURE` for new feature, `FIX` if resolve problem, `WIP` if not finish your job ...). Run `git push` when you're done.
- `Refrain from editing the repository through GitHub`. Changes made with the GitHub editor are cumbersome and harder to evaluate, especially changes made to the source code. Changes made on a local working copy are more reliable and more appropriate pull requests.

> OK, nobody is perfect. Don't feel intimidated if you don't know how to do all that stuff. I won't turn down your proposal right away just because you have failed any of these prerequisites, too. When applicable, I can do the necessary amendments and apply your changes. Just be careful and do your best!
25 changes: 25 additions & 0 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build and Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install Dependencies
run: npm i
- name: Build
run: npm run build
- name: Deploy to GH-Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
branch: gh-pages
folder: dist
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Development Server - Browser Debug",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"preLaunchTask": "Development Server - Start",
"postDebugTask": "Development Server - Stop"
}
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Development Server - Start",
"type": "shell",
"command": "pnpm start",
"isBackground": true,
"problemMatcher": {
// There's no better way to run the browser after tasks
// @TODO: Need refacto maybe
"owner": "custom",
"pattern": {
"regexp": ".*",
"file": 1,
"location": 2,
"message": 3
},
"background": {
"activeOnStart": true,
"beginsPattern": ".*VITE.*",
"endsPattern": ".*ready in.*ms"
}
},
"presentation": {
"reveal": "always",
"panel": "shared",
}
},
{
"label": "Development Server - Stop",
"type": "shell",
"command": "kill $(lsof -t -i:3000)",
"problemMatcher": [],
"presentation": {
"reveal": "silent",
"panel": "dedicated"
}
}
]
}
14 changes: 12 additions & 2 deletions RELEASE_NOTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

> Disclaimer : I am a French developer, my English limits this to English video games and the different documentation I read.
### Version : 0.0.1
### Version : 0.0.2

WIP !
- Use ViteJs instead of esbuild
- Improve config files (tsconfig, eslint...)
- Add husky and lint-staged to stop commit
- Refacto Player
- Using Linear to smooth speed
- Refacto Life controller
- Add better control to increase or decrease heart or extra
- Add max value to heart and extra
- Refacto debug GUI
- Remove Heroes, expect Knight
- Refacto some HUD class
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
},
"private": true,
"volta": {
"node": "20.11.0"
"node": "20.11.1",
"pnpm": "8.15.3"
}
}
1 change: 0 additions & 1 deletion src/scripts/decorators/Contructor.ts

This file was deleted.

93 changes: 0 additions & 93 deletions src/scripts/objects/debug/GUI.ts

This file was deleted.

27 changes: 27 additions & 0 deletions src/scripts/objects/debug/panel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as EssentialsPlugin from '@tweakpane/plugin-essentials'

import { Pane } from 'tweakpane'
import { PlayerBase } from '../../player/PlayerBase'
import { PlayerPanel } from './player.panel'

export function DebugGUI(scene: Phaser.Scene, player: PlayerBase) {
const pane = new Pane({
title: 'Procedural Dungeon Debug',
})
pane.registerPlugin(EssentialsPlugin)

const game_folder = pane.addFolder({
title: 'Game',
expanded: false,
})

game_folder.addBinding(scene.game.loop, 'actualFps', {
readonly: true,
label: 'FPS',
view: 'graph',
min: 0,
max: 120,
})

PlayerPanel(pane, player)
}
111 changes: 111 additions & 0 deletions src/scripts/objects/debug/panel/player.panel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { Life } from '@game/objects/base/Life'
import { StatisticBase } from '@game/objects/base/Statistics'
import { PlayerBase } from '@game/objects/player/PlayerBase'
import { PLAYER_EMITTER } from '@game/objects/player/type'
import { PlayerEmitter } from '@game/utils/events'
import type { FolderApi, Pane } from 'tweakpane'

const DEFAULT_NUMBER_DISPLAYER_CONFIG = {
readonly: true,
format: (value: number) => value.toFixed(0),
}

export function PlayerPanel(panel: Pane, player: PlayerBase) {
const playerFolder = panel.addFolder({
title: 'Player',
expanded: false,
})

playerFolder.addBinding(player.body, 'speed', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
label: 'Body Speed',
})

PlayerPanelStatistic(playerFolder, player._statistics)
PlayerPanelLife(playerFolder, player._life)
}

function PlayerPanelStatistic(playerFolder: FolderApi, statistics: StatisticBase) {
const statisticFolder = playerFolder.addFolder({
title: 'Statistics',
expanded: false,
})

statisticFolder.addBinding(statistics, 'attack_distance', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

statisticFolder.addBinding(statistics, 'attack_speed', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

statisticFolder.addBinding(statistics, 'luck', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

statisticFolder.addBinding(statistics, 'speed', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

statisticFolder.addBinding(statistics, 'strength', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})
}

function PlayerPanelLife(playerFolder: FolderApi, life: Life) {
const lifeFolder = playerFolder.addFolder({
title: 'Life controller',
expanded: false,
})

lifeFolder.addBinding(life, 'max_total', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

lifeFolder.addBinding(life, 'heart', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

lifeFolder.addBinding(life, 'extra', {
...DEFAULT_NUMBER_DISPLAYER_CONFIG,
})

const add_remove = [
['+1 H', '-1 H'],
['+1 E', '-1 E'],
]

lifeFolder
.addBlade({
view: 'buttongrid',
size: [2, 2],
cells: (x: number, y: number) => ({
title: add_remove[x][y],
}),
label: 'Health',
})
.on('click', ({ index }: { index: [number, number] }) => {
const [x, y] = index
if (x === 0 && y === 0) PlayerEmitter.emit(PLAYER_EMITTER.HEALTH_UP, 'heart')
if (x === 0 && y === 1) PlayerEmitter.emit(PLAYER_EMITTER.HEALTH_DOWN, 'heart')
if (x === 1 && y === 0) PlayerEmitter.emit(PLAYER_EMITTER.HEALTH_UP, 'extra')
if (x === 1 && y === 1) PlayerEmitter.emit(PLAYER_EMITTER.HEALTH_DOWN, 'extra')
})

lifeFolder
.addBlade({
view: 'buttongrid',
size: [2, 2],
cells: (x: number, y: number) => ({
title: add_remove[x][y],
}),
label: 'Heal\nDamage',
})
.on('click', ({ index }: { index: [number, number] }) => {
const [x, y] = index
if (x === 0 && y === 0) PlayerEmitter.emit(PLAYER_EMITTER.HEAL, 'heart', 1)
if (x === 0 && y === 1) PlayerEmitter.emit(PLAYER_EMITTER.DAMAGE, 'heart', 1)
if (x === 1 && y === 0) PlayerEmitter.emit(PLAYER_EMITTER.HEAL, 'extra', 1)
if (x === 1 && y === 1) PlayerEmitter.emit(PLAYER_EMITTER.DAMAGE, 'extra', 1)
})
}
Loading

0 comments on commit a6afa6a

Please sign in to comment.