Skip to content

Commit 3fdec3f

Browse files
update snake
1 parent 0d07313 commit 3fdec3f

File tree

12 files changed

+1532
-883
lines changed

12 files changed

+1532
-883
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"coin-runner": "cd src/games/coin-runner && yarn && yarn run serve-dev",
3838
"endless-runner": "cd src/games/endless-runner && yarn && yarn run serve-dev",
3939
"flappy-bird": "cd src/games/flappy-bird && yarn && yarn run serve-dev",
40-
"snake": "cd src/games/snake && yarn && yarn run dev",
40+
"snake": "cd src/games/snake && yarn && yarn run serve-dev",
4141
"space-invaders": "cd src/games/space-invaders && yarn && yarn run dev",
4242
"space-shooter": "cd src/games/space-shooter && yarn && yarn run dev",
4343
"super-mario-land": "cd src/games/super-mario-land && yarn && yarn run dev",

src/games/snake/package.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
{
22
"name": "snake",
3-
"version": "2.0.0",
3+
"version": "0.0.1",
44
"description": "Snake for Phaser 3 in TypeScript",
55
"keywords": [],
6+
"scripts": {
7+
"build-dev": "webpack --mode development",
8+
"build-prod": "webpack --mode production",
9+
"serve-dev": "webpack --mode development && webpack serve --mode development"
10+
},
611
"devDependencies": {
7-
"expose-loader": "4.0.0",
8-
"ts-loader": "9.3.1",
9-
"typescript": "4.8.0-dev.20220730",
10-
"webpack": "5.74.0",
11-
"webpack-cli": "4.10.0",
12-
"webpack-dev-server": "4.9.3"
12+
"@types/node": "20.11.25",
13+
"@types/webpack": "5.28.5",
14+
"copy-webpack-plugin": "12.0.2",
15+
"expose-loader": "5.0.0",
16+
"html-webpack-plugin": "5.6.0",
17+
"ts-loader": "9.5.1",
18+
"ts-node": "10.9.2",
19+
"typescript": "5.4.2",
20+
"webpack": "5.90.3",
21+
"webpack-cli": "5.1.4",
22+
"webpack-dev-server": "5.0.2"
1323
},
1424
"dependencies": {
15-
"phaser": "3.60.0-beta.9"
16-
},
17-
"scripts": {
18-
"dev": "webpack --mode development && webpack serve --mode development"
25+
"phaser": "3.80.1"
1926
},
2027
"repository": {
2128
"type": "git",
File renamed without changes.
File renamed without changes.

src/games/snake/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { MainMenuScene } from './scenes/main-menu-scene';
55
export const GameConfig: Phaser.Types.Core.GameConfig = {
66
title: 'Snake',
77
url: 'https://github.com/digitsensitive/phaser3-typescript',
8-
version: '2.0',
8+
version: '0.0.1',
99
width: 256,
1010
height: 224,
1111
zoom: 3,
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
56
<meta name="author" content="digitsensitive" />
6-
<title>Snake</title>
7-
<script src="dist/bundle.js"></script>
7+
<title><%= htmlWebpackPlugin.options.title %></title>
88
</head>
99
<body>
10-
<h1>Snake</h1>
1110
<div id="game"></div>
1211
</body>
1312
</html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface IGraphicsConstructor {
1+
export interface GraphicsConstructor {
22
scene: Phaser.Scene;
33
options?: Phaser.Types.GameObjects.Graphics.Options;
44
}

src/games/snake/src/objects/apple.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { CONST } from '../const/const';
2-
import { IGraphicsConstructor } from '../interfaces/graphics.interface';
2+
import { GraphicsConstructor } from '../interfaces/graphics.interface';
33

44
export class Apple extends Phaser.GameObjects.Graphics {
5-
constructor(aParams: IGraphicsConstructor) {
6-
super(aParams.scene, aParams.options);
7-
this.x = aParams.options.x;
8-
this.y = aParams.options.y;
5+
constructor(params: GraphicsConstructor) {
6+
super(params.scene, params.options);
7+
this.x = params.options.x;
8+
this.y = params.options.y;
99
this.fillStyle(0x61e85b, 0.8);
1010
this.fillRect(
1111
CONST.FIELD_SIZE,

src/games/snake/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"target": "ES6",
44
"module": "CommonJS",
55
"moduleResolution": "node",
6-
"noImplicitAny": true
6+
"noImplicitAny": true,
7+
"strict": false,
8+
"esModuleInterop": true // webpack.config.ts
79
},
810
"include": ["src/**/*"],
911
"exclude": ["node_modules"]

src/games/snake/webpack.config.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)