Commit 19ee0ea0 authored by Grigoriy Tretyakov's avatar Grigoriy Tretyakov

add starter code

parent 7999c419
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Dependency directories
node_modules/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Racing car # Racing car
## TODO: *TODO*: Пусть будет простая игра, в которой гоночная машинка должна собрать все колёса в заданную область, не сбив при этом ни одного человека (ходят) и конуса (не двигаются). Своеобразный кёрлинг.
Пусть будет простая игра, в которой гоночная машинка должна собрать все колёса в заданную область, не сбив при этом ни одного человека (ходят) и конуса (не двигаются). Своеобразный кёрлинг.
assets/pic.png

504 Bytes

This diff is collapsed.
{
"name": "phaser3-starterkit",
"version": "1.0.0",
"description": "Game starter kit",
"main": "src/index.js",
"scripts": {
"start": "./node_modules/.bin/webpack-dev-server",
"build": "./node_modules/.bin/webpack --config webpack.production.config.js",
"build:dev": "./node_modules/.bin/webpack"
},
"author": "gt",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"copy-webpack-plugin": "^4.5.2",
"webpack": "^3.12.0",
"webpack-dev-server": "^2.11.2"
},
"dependencies": {
"phaser": "^3.11.0"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>racing-car-game</title>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta http-equiv="cleartype" content="on">
<meta name="format-detection" content="telephone=no">
<style>
html, body {
margin: 0;
padding: 0;
image-rendering: optimizeSpeed; /* Older versions of FF */
image-rendering: -moz-crisp-edges; /* FF 6.0+ */
image-rendering: -webkit-optimize-contrast; /* Webkit (non standard naming) */
image-rendering: -o-crisp-edges; /* OS X & Windows Opera (12.02+) */
image-rendering: crisp-edges; /* Possible future browsers. */
-ms-interpolation-mode: nearest-neighbor; /* IE (non standard naming) */
image-rendering: pixelated; /* Chrome 41 */
}
body {
margin: 50px auto;
width: 300px;
}
#game {
margin: 0 auto;
}
</style>
</head>
<body>
<div id="game" style=""></div>
<script type="text/javascript" src="vendor-libs.js"></script>
<script type="text/javascript" src="racing-car-game.js"></script>
</body>
</html>
import 'phaser';
class Game extends Phaser.Scene {
constructor() {
super({key: 'Game'});
this.PIC = 'picture';
}
preload() {
this.load.image(this.PIC, 'assets/pic.png');
}
create() {
this.add.text(60, 250, 'This is a game!', {font: '20px monospace'});
this.add.image(150, 150, this.PIC);
}
}
const config = {
type: Phaser.AUTO,
parent: 'game',
width: 300,
height: 400,
scene: [
Game,
]
}
new Phaser.Game(config);
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: {
app: './src/index.js',
'vendor-libs': ['phaser']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'racing-car-game.js'
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'src/'),
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
},
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
},
plugins: [
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'src', 'index.html'),
to: path.resolve(__dirname, 'dist')
},
{
from: path.resolve(__dirname, 'assets', '**', '*'),
to: path.resolve(__dirname, 'dist')
}
]),
new webpack.DefinePlugin({
'typeof CANVAS_RENDERER': JSON.stringify(true),
'typeof WEBGL_RENDERER': JSON.stringify(true)
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor-libs',
filename: 'vendor-libs.js'
}),
],
}
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: {
app: './src/index.js',
'vendor-libs': ['phaser']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'racing-car-game.js'
},
module: {
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'src/'),
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
},
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
},
plugins: [
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'src', 'index.html'),
to: path.resolve(__dirname, 'dist')
},
{
from: path.resolve(__dirname, 'assets', '**', '*'),
to: path.resolve(__dirname, 'dist')
}
]),
new webpack.optimize.UglifyJsPlugin({
drop_console: true,
minimize: true,
output: {
comments: false
}
}),
new webpack.DefinePlugin({
'typeof CANVAS_RENDERER': JSON.stringify(true),
'typeof WEBGL_RENDERER': JSON.stringify(true)
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor-libs',
filename: 'vendor-libs.js'
}),
],
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment