Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/game logic #1

Open
wants to merge 69 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
b5c1807
Added basic assets
angarita-dev Jul 21, 2020
5d4629c
Added resources, player movement & basic platforms
angarita-dev Jul 21, 2020
78cd1c6
Platform generation & reuse logic
angarita-dev Jul 22, 2020
e0361e3
Added moving platforms
angarita-dev Jul 23, 2020
521b56f
Moved platform generation logic to its class
angarita-dev Jul 23, 2020
2ff5af1
Modified platform generation parameters
angarita-dev Jul 23, 2020
c71faa5
Refactored game to be a scene
angarita-dev Jul 23, 2020
c69673b
Added death scene
angarita-dev Jul 23, 2020
b19d940
Changed moving platform file name
angarita-dev Jul 24, 2020
0265a20
Changed physics of platforms & modified platform y
angarita-dev Jul 24, 2020
4220893
Added item logic
angarita-dev Jul 24, 2020
9868d11
Passed score to death scene
angarita-dev Jul 24, 2020
604f657
Added item recollection display
angarita-dev Jul 24, 2020
84d182b
Added resources to webpack & changed preload method
angarita-dev Jul 24, 2020
7684dd9
Changed locations & scale method
angarita-dev Jul 27, 2020
5638800
Fixed game jump
angarita-dev Jul 27, 2020
601aa54
Added increased difficulty & fixed movement
angarita-dev Jul 27, 2020
9c4f3c6
Added platfrom manager & simplified platform manipulation logic
angarita-dev Jul 27, 2020
c551f01
Reduced difficulty
angarita-dev Jul 27, 2020
2fcc69a
Removed unused package
angarita-dev Jul 27, 2020
b80e11f
Reduced difficulty again & ignored dev file
angarita-dev Jul 27, 2020
c370b01
Changed resize method
angarita-dev Jul 27, 2020
3b74556
Changed resize method
angarita-dev Jul 27, 2020
182e444
Merge branch 'feature/game-logic' of github.com:codingAngarita/anothe…
angarita-dev Jul 27, 2020
bd6d202
Changed star spawn probability & resize
angarita-dev Jul 27, 2020
f83f523
Changed webpack to handle sass files
angarita-dev Jul 29, 2020
4e00044
Added background scenes
angarita-dev Jul 30, 2020
fb438bd
Fixed indent
angarita-dev Jul 30, 2020
89131bb
Added title scene
angarita-dev Jul 30, 2020
05fe9cb
Added moving clouds
angarita-dev Jul 31, 2020
2503e50
Added background mountains & moved title text accordingly
angarita-dev Jul 31, 2020
9a9cd1e
Added background scrolling & death handle
angarita-dev Jul 31, 2020
79cf612
Added transitions for title scene
angarita-dev Jul 31, 2020
a0c8b66
Added character selection and added replay functionality
angarita-dev Jul 31, 2020
96cda3b
Fixed back mountains tiling problem
angarita-dev Aug 1, 2020
9a18d88
Added utils scene and moved repeted logic
angarita-dev Aug 1, 2020
a92090a
Fixed fade duration bug
angarita-dev Aug 1, 2020
1b4916b
Added falling animation
angarita-dev Aug 1, 2020
f044e30
Modified death fades
angarita-dev Aug 1, 2020
cf5bf5e
Added character & collectible custom sprites
angarita-dev Aug 2, 2020
1109dd5
Added random platforms
angarita-dev Aug 2, 2020
867ad5f
Removed unused assets
angarita-dev Aug 2, 2020
d413de2
Added missing package
angarita-dev Aug 2, 2020
59870cc
Added missing package
angarita-dev Aug 2, 2020
cc99834
Merge branch 'feature/game-logic' of github.com:codingAngarita/anothe…
angarita-dev Aug 2, 2020
cb0ebf9
Update game.js
angarita-dev Aug 2, 2020
42ad790
Added functionalities & solved duration bug
angarita-dev Aug 2, 2020
226fc07
Added credits scene
angarita-dev Aug 2, 2020
167243d
Added early scoreboard
angarita-dev Aug 2, 2020
199b48e
Stoping credits scene
angarita-dev Aug 2, 2020
e4f9c5e
Merge branch 'feature/game-logic' of github.com:codingAngarita/anothe…
angarita-dev Aug 2, 2020
84c1e4c
Added dotenv to webpack
angarita-dev Aug 3, 2020
a4308f1
Added support for Async JS in Babel
angarita-dev Aug 3, 2020
f6ebd2c
Changed assets
angarita-dev Aug 3, 2020
26a8f0a
Added change in color of score when sky gets dark
angarita-dev Aug 3, 2020
250b595
Added scoreboard
angarita-dev Aug 4, 2020
1fdbc23
Modified dotenv-webpack config
angarita-dev Aug 4, 2020
9bec0e5
Removed unused stylesheet import
angarita-dev Aug 4, 2020
aaca1c5
Fixed bug where counter didnt change color on black sky
angarita-dev Aug 4, 2020
69fa801
Added config for tests
angarita-dev Aug 4, 2020
992dd0e
Added tests and added command description in the README
angarita-dev Aug 6, 2020
6578381
fixed linter errors and added command to README
angarita-dev Aug 6, 2020
f40ed65
Updated readme with assets info & status badge
angarita-dev Aug 6, 2020
b7cac5a
Added live version
angarita-dev Aug 6, 2020
1d2634a
Added style linter
angarita-dev Aug 6, 2020
5fa306d
Added info about local setup, API & how to play
angarita-dev Aug 9, 2020
6e8866d
Added title art image to readme
angarita-dev Aug 9, 2020
d5d6ad0
Added additional info & changed live version style
angarita-dev Aug 11, 2020
ccbaba6
Fixed broken badge
angarita-dev Aug 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{
"env": {
"test": {
"presets": [["@babel/preset-env"]]
}
},
"presets": [
["@babel/env", {
"targets": {
"browsers": [
">0.25%",
"not ie 11",
"not op_mini all"
]
},
"modules": false
}]
[
"@babel/env", {
"targets": {
"browsers": [
">0.25%",
"not ie 11",
"not op_mini all"
]
},
"modules": false
}
]
],
"plugins": ["@babel/plugin-transform-runtime"]
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ dist/

# Swap files
*.swp

# Dev build stylesheets
stylesheet.css
stylesheet.css.map

# Removing .env
.env
10 changes: 10 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["stylelint-config-standard"],
"plugins": ["stylelint-scss", "stylelint-csstree-validator"],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"csstree/validator": true
},
"ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css", "dev/**"]
}
83 changes: 76 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Another platformer


[![Netlify Status](https://api.netlify.com/api/v1/badges/71ac9d36-b299-425d-ab9d-0d74cb446f0d/deploy-status)](https://another-platformer.netlify.app/)
[![MIT license](https://img.shields.io/github/license/codingAngarita/another-platformer)](https://codingangarita.mit-license.org/)
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.png?v=103)](https://github.com/ellerbrock/open-source-badges/)

<p align="center">
<img alt="Another platformer" src="https://i.imgur.com/XBl9jpq.png?1" />
</p>

A Phaser 3 platformer game with ES6 support via [Babel 7](https://babeljs.io/) and [Webpack 4](https://webpack.js.org/)
that includes hot-reloading for development and production-ready builds.
Expand All @@ -11,9 +15,64 @@ Used [phaser3-project-template](https://github.com/photonstorm/phaser3-project-t

Loading images via JavaScript module `import` is also supported.

#### You can read more about the project and how I built it [here](https://www.notion.so/Another-platfomer-252734103ed24f26a87967fd79775c7d)

## How to play
#### Check a live version of the game [here](https://another-platformer.netlify.app/).

You can navigate the menus clicking the desired options.

The game objective is to jump through the platforms collecting all the items you can, everytime you collect an items the platforms start moving more quickly,to move, use the keyboard arrow keys &#8592; &#8593; &#8594; &#8595;

![How to play](https://i.imgur.com/AIzcJc8.png "How to play")

## How to setup the game locally

To run the game locally you should clone this repository, run `npm install` to install all the project dependencies and then you can run `npm start` to start a local web server running the project.

**Be aware, the game uses an `API` to submit and receive all the leaderboard data, you should setup your own `API` to mantain this feature. The section below contains relevant information describing the `API` in detail.**

## Api

Setting up the API is beyond the objective of this project, however here are the needed information to use the built in [api module](https://github.com/codingAngarita/another-platformer/blob/feature/game-logic/src/classes/api.js) as is, please modify it acording to your needs.

The API consists of an **API_URL** `https://your-leaderboard-api-url/`, an **API_KEY** `1234567890`.
that contains an endpoint `/scores/` making the final api url: `API_URL` + `API_KEY` + `/scores/`.

The **API_URL** and **API_KEY** values should be setted up in a `.env` file in the root of the project, this `.env` file is already added to the `.gitignore` file, don't commit this file unless you don't mind the API going public. The `.env` file should look something like this:

```
# ./.env
API_URL=https://your-leaderboard-api-url/
API_KEY=1234567890
```

To submit a new score, the API should receive a POST request in JSON format with the following body:
```JSON
{
"user": "New Score User",
"score": 39
}
```
To receive all the scores, the API should respond to a GET request to with no parameters, and return a JSON in this format:
```JSON
{
"result": [
{
"user": "Low score user",
"score": 9
},
{
"user": "High score user",
"score": 999
}
]
}
```

## Requirements

[Node.js](https://nodejs.org) is required to install dependencies and run scripts via `npm`.
[npm](https://www.npmjs.com/) is required to install dependencies and run scripts via `npm`.

## Available Commands

Expand All @@ -22,10 +81,8 @@ Loading images via JavaScript module `import` is also supported.
| `npm install` | Install project dependencies |
| `npm start` | Build project and open web server running project |
| `npm run build` | Builds code bundle with production settings (minification, uglification, etc..) |

## License

This projects uses the MIT license.
| `npm run test` | Runs tests on Api methods |
| `npm run linters` | Runs JS linters |

## Modifying the code

Expand All @@ -36,3 +93,15 @@ server by running `npm start`.
After starting the development server with `npm start`, you can edit any files in the `src` folder
and webpack will automatically recompile and reload your server (available at `http://localhost:8080`
by default).

Please make sure to run the linters & tests before submiting any changes.

## License

This projects uses the MIT license.

### Assets

All the assets used in this project were made by me and "Jeromimo" please reach out before using them.


2 changes: 2 additions & 0 deletions index.html → dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<meta charset="utf-8">
</head>
<body>
<div id="divId">
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions dev/stylesheet.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dev/stylesheet.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading