Skip to content

Commit

Permalink
🔧 Replace webpack -> snowpack
Browse files Browse the repository at this point in the history
  • Loading branch information
rootasjey committed Jul 18, 2020
1 parent 96939d5 commit 774f42b
Show file tree
Hide file tree
Showing 33 changed files with 1,032 additions and 82,254 deletions.
Binary file removed assets/logo.png
Binary file not shown.
24 changes: 0 additions & 24 deletions index-dev.html

This file was deleted.

24 changes: 0 additions & 24 deletions index-prd.html

This file was deleted.

34 changes: 15 additions & 19 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
{
"name": "cycles",
"version": "0.8.0",
"name": "backwards",
"version": "0.10.0",
"author": "Jeremie CORPINOT",
"description": "A turn based game system built with Phaser",
"license": "MIT",
"scripts": {
"build:dev": "webpack --env dev",
"build:prd": "webpack --env prd",
"download-phaser-typedef": "download --out typings https://raw.githubusercontent.com/photonstorm/phaser3-docs/master/typescript/phaser.d.ts",
"start": "webpack-dev-server -d --env dev",
"start": "snowpack dev",
"build": "snowpack build",
"format": "prettier --write 'src/**/*.js'",
"lint": "prettier --check 'src/**/*.js'",
"test": "ava",
"watch": "webpack --env dev --watch"
"test:watch": "ava --watch"
},
"prettier": {
"printWidth": 140
},
"dependencies": {
"copy-webpack-plugin": "6.0.3",
"pathfinding": "0.4.18",
"phaser": "3.24.1",
"typescript": "3.9.7",
"webpack": "4.43.0",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
"phaser": "3.24.1"
},
"devDependencies": {
"@types/node": "14.0.23",
"@types/pathfinding": "0.0.4",
"@types/webpack": "4.41.21",
"ava": "3.10.1",
"download-cli": "1.1.1",
"raw-loader": "4.0.1",
"ts-loader": "8.0.1",
"prettier": "2.0.5",
"snowpack": "2.0.0",
"ts-node": "8.10.2",
"tslint": "6.1.2"
"tslint": "6.1.2",
"typescript": "3.9.7"
},
"ava": {
"extensions": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added public/favicon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="icon" href="/favicon.ico"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content="Web site created using create-snowpack-app"/>
<title>Snowpack App</title>
<link href="https://unpkg.com/sanitize.css" rel="stylesheet" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/_dist_/index.js"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
7 changes: 7 additions & 0 deletions snowpack.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"scripts": {
"mount:public": "mount public --to /",
"mount:src": "mount src --to /_dist_"
},
"plugins": []
}
5 changes: 5 additions & 0 deletions snowpack.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"canvas-confetti": "https://cdn.pika.dev/pin/[email protected]/canvas-confetti.js"
}
}
6 changes: 3 additions & 3 deletions src/gameObjects/TileUnit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as PF from 'pathfinding';
import pathfinding from 'pathfinding';
import { colors } from '../const/config';
import { Unit } from '../logic/Unit';
import { Game } from './Game';
Expand Down Expand Up @@ -391,8 +391,8 @@ export default class TileUnit extends Phaser.GameObjects.GameObject {
private getUnitPath({ startX = 0, startY = 0 }, { endX = 0, endY = 0 }) {
const { mapMatrix } = Game.gameMap;

const grid = new PF.Grid(mapMatrix);
const finder = new PF.BestFirstFinder();
const grid = new pathfinding.Grid(mapMatrix);
const finder = new pathfinding.BestFirstFinder();

return finder.findPath(startX, startY, endX, endY, grid);
}
Expand Down
78 changes: 78 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import Phaser from "phaser";

import BootScene from './scenes/boot';
import MenuScene from './scenes/menu';
import PlayScene from './scenes/play';

import { Game } from './gameObjects/Game';

window.addEventListener("load", () => {
Game.instance = new Phaser.Game({
// See <https://github.com/photonstorm/phaser/blob/master/src/boot/Config.js>
scale: {
mode: Phaser.Scale.NONE,
width: 812,
height: 812,
},
// zoom: 1,
// resolution: 1,
type: Phaser.AUTO,
// parent: null,
// canvas: null,
// canvasStyle: null,
// seed: null,
title: 'Backwards',
version: '0.10.0',
url: 'https://github.com/rootasjey/backwards',
// input: {
// keyboard: true,
// mouse: true,
// touch: true,
// gamepad: false
// },
// disableContextMenu: false,
// banner: false
banner: {
// hidePhaser: false,
// text: 'white',
background: ['#e54661', '#ffa644', '#998a2f', '#2c594f', '#002d40'],
},
// fps: {
// min: 10,
// target: 60,
// forceSetTimeout: false,
// },
// antialias: false,
render: {
// antialias: true,
pixelArt: true,
// roundPixels: true,
},
// transparent: false,
// clearBeforeRender: true,
// backgroundColor: 0x000000, // black
loader: {
// baseURL: '',
path: 'assets/',
// maxParallelDownloads: 32,
// crossOrigin: 'anonymous',
// timeout: 0
},
physics: {
// default: 'arcade',
// arcade: {
// gravity: {
// y: 180
// }
// }
// default: false,
},
scene: [
BootScene,
MenuScene,
PlayScene,
],
});

return Game.instance;
});
72 changes: 0 additions & 72 deletions src/initialize.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/logic/Unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ export class Unit {

if (!this.inventory.getWeapon(0)) { return 0; }

const { ctr, rank } = this.inventory.getWeapon(0);
const { crt, rank } = this.inventory.getWeapon(0);

let sRankBonus = 0;

if (rank === WeaponRanks.S) { sRankBonus = 5; }

return ((skl / 2) + sRankBonus + ctr) - ennemyLuck;
return ((skl / 2) + sRankBonus + crt) - ennemyLuck;
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/sprites/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Phaser from "phaser";

export type ConstructorParams = {
x: number;
y: number;
scene: Phaser.Scene;
texture?: string;
};

export abstract class Base extends Phaser.Physics.Arcade.Sprite {
constructor({ scene, x, y, texture }: ConstructorParams) {
super(scene, x, y, texture, 0);
}
}
Loading

0 comments on commit 774f42b

Please sign in to comment.