Micro Wars is a space shooter 2D Arcade type game created with Phaser 3 framework.
Clone the repository into your local computer.
First you'll have to install the newest version of Node. Then move into the project main directory on the console and follow the instructions below.
Install all the necessary packages:
$ npm install
To be sure, that npm is able to run scripts, lets set the ignore-scripts
configuration key to false:
$ npm config set ignore-scripts false
You can find the scripts in the
package.json
file in thescripts
section.
Build and open up the app in the browser:
$ npm start
The main file of which the bundle is created is set in the entry:
entry: './src/javascript/index.js'
The output file of the JavaScript bundle set in the output:
output: {
path: path.resolve(process.cwd(), 'dist'),
},
The output file name of the CSS bundle is set in the plugins:
plugins: [
new MiniCssExtractPlugin({
filename: "main.css"
})
]
In postcss.config.js there is a check for process.env.NODE_ENV variable. The thing is even if you set Webpack mode to production in webpack.config.js
it won't automatically change Node environment variable.
The simplest way to configure this is to install cross-env package:
$ npm install --save-dev cross-env
Now when you run npx cross-env NODE_ENV=production webpack --config webpack.config.js
the process.env.NODE_ENV variable will be production and postcss.config.js check is going to work:
if(process.env.NODE_ENV === 'production') {
module.exports = {
plugins: [
require('autoprefixer'),
require('cssnano')
]
}
}
From Webpack documentation: Technically, NODE_ENV is a system environment variable that Node.js exposes into running scripts. It is used by convention to determine dev-vs-prod behavior by server tools, build scripts, and client-side libraries. Contrary to expectations, process.env.NODE_ENV is not set to "production" within the build script webpack.config.js. Thus, conditionals like process.env.NODE_ENV === 'production' ? '[name].[hash].bundle.js' : '[name].bundle.js'
within webpack configurations do not work as expected.
Run Jest test runner:
$ npm test
Run the command:
npx eslint .
ESLint has the auto fix option as well, for that you'll have to run the command:
npx eslint . --fix
The goal is to collect as high score as possible through shooting enemy spaceships.
Player Fighter
Points For Ships
- Enemy Chaser - 10
- Enemy Fighter - 15
- Enemy Carrier - 25
Move Commands
- Up Arrow Key
- Left Arrow Key
- Right Arrow Key
- Down Arrow Key
Shoot Commands
- Spacebar
- JavaScript - Programming language used
- Phaser 3 - WebGL and Canvas framework used
- Webpack - Bundler used
- HTML - Hypertext Markup Language
- SCSS - Sassy CSS
- CSS - Cascading Style Sheets
- VS Code - The code editor used
- "More planets" by cemkalyoncu - Images used
- "Blue Fighter Spaceship" by MillionthVector - Image used
- "Red Cruiser Spaceship" by MillionthVector - Image used
- "Fighter2 Spaceship" by MillionthVector - Image used
- "Buttons sci-fi" by imacat - Images used
- "Fireball Effect" by Cethiel - Sprite used
- Explosion sprite - Sprite used
- Andromeda - Font used
- Atures - Font used
- Trench - Font used
👤 Jaak Kivinukk
- Github: @Jaakal
- Twitter: @JKivinukk
- Linkedin: Jaak Kivinukk
- Email: jaak.kivinukk@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details