2018-04-07 15:59:16 -04:00
<!-- Top -->
2016-09-01 08:56:21 -07:00
# FullScreenPokemon
2017-12-29 08:23:12 -08:00
[](https://greenkeeper.io/)
2016-09-01 08:56:21 -07:00
[](https://travis-ci.org/FullScreenShenanigans/FullScreenPokemon)
[](http://badge.fury.io/js/fullscreenpokemon)
2016-01-08 21:06:30 -08:00
2016-09-01 08:56:21 -07:00
A free HTML5 remake of the original Pokemon, expanded for modern browsing.
2018-04-07 15:59:16 -04:00
<!-- /Top -->
2015-01-01 20:06:27 -05:00
2017-12-05 18:56:54 -08:00
## Usage
2018-01-08 07:53:46 -08:00
The built `src/index.html` uses [UserWrappr ](https://github.com/FullScreenShenanigans/UserWrappr ) to fill the available window size with a game screen, option menus, and piped input events.
It stores its generated instance as `window.FSP` .
To do this in your own page, use the exported `createFspInterface` function.
``` javascript
import { createFspInterface } from "fullscreenpokemon" ;
createFspInterface ( document . getElementById ( "game" ) )
. then ( ( ) => {
console . log ( "Ready to play!" ) ;
console . log ( FSP ) ;
} ) ;
```
You can also directly create a new `FullScreenPokemon` instance with a manual size.
``` javascript
2017-12-05 18:56:54 -08:00
import { FullScreenPokemon } from "fullscreenpokemon" ;
2018-01-08 07:53:46 -08:00
// Creates a new game with a 320x480 screen size
2017-12-29 18:32:30 -08:00
const fsp = new FullScreenPokemon ( {
height : 320 ,
width : 480 ,
} ) ;
2017-12-05 18:56:54 -08:00
2018-01-08 07:53:46 -08:00
// Games contain a .canvas member for the screen
2017-12-05 18:56:54 -08:00
document . body . appendChild ( fsp . canvas ) ;
2018-01-08 07:53:46 -08:00
// Shows the initial in-game menu with start and load options
fsp . gameplay . gameStart ( ) ;
2017-12-05 18:56:54 -08:00
```
2018-01-08 07:53:46 -08:00
> By default, the game doesn't set up input events.
> You'll need to set up your own event registrations manually.
2017-12-29 18:32:30 -08:00
2018-02-02 10:34:48 -08:00
### Documentation
2018-05-20 15:50:16 -07:00
FSP is built on top of [EightBittr ](https://github.com/FullScreenShenanigans/EightBittr ), a modular TypeScript game engine split across separate projects available on npm and hosted on GitHub in the [FullScreenShenanigans ](https://github.com/FullScreenShenanigans ) organization.
2018-02-02 10:34:48 -08:00
It consists of a couple dozen core modules under this organization.
See [./src/docs ](https://github.com/FullScreenShenanigans/FullScreenPokemon/tree/master/docs ) for documentation specific to FullScreenPokemon.
2017-12-29 18:32:30 -08:00
2018-04-07 15:59:16 -04:00
<!-- Development -->
2017-05-08 18:11:51 -07:00
## Development
2015-01-01 20:06:27 -05:00
2018-01-11 23:54:21 -08:00
After [forking the repo from GitHub ](https://help.github.com/articles/fork-a-repo/ ):
2017-12-29 08:23:12 -08:00
```
2018-01-11 23:54:21 -08:00
git clone https://github.com/<your-name-here>/FullScreenPokemon
2017-12-29 08:23:12 -08:00
cd FullScreenPokemon
2018-01-11 23:54:21 -08:00
npm install
2017-12-29 08:23:12 -08:00
npm run setup
npm run verify
```
2015-01-01 20:06:27 -05:00
2017-12-29 08:23:12 -08:00
* `npm run setup` creates a few auto-generated setup files locally.
* `npm run verify` builds, lints, and runs tests.
### Building
``` shell
npm run watch
```
Source files are written under `src/` in TypeScript and compile in-place to JavaScript files.
`npm run watch` will directly run the TypeScript compiler on source files in watch mode.
Use it in the background while developing to keep the compiled files up-to-date.
2018-04-07 15:59:16 -04:00
#### Running Tests
2017-12-29 08:23:12 -08:00
``` shell
npm run test
```
2018-04-07 15:59:16 -04:00
Tests are written in [Mocha ](https://github.com/mochajs/mocha ) and [Chai ](https://github.com/chaijs/chai ).
Their files are written using alongside source files under `src/` and named `*.test.ts?` .
2018-03-04 18:58:39 -08:00
Whenever you add, remove, or rename a `*.test.t*` file under `src/` , `watch` will re-run `npm run test:setup` to regenerate the list of static test files in `test/index.html` .
2017-12-29 08:23:12 -08:00
You can open that file in a browser to debug through the tests.
2018-04-07 15:59:16 -04:00
<!-- Maps -->
#### Maps Tests
FullScreenPokemon includes automated tests in `src/Maps.test.ts` that loop over every map and location in the game.
That file is generated as part of `npm run setup` .
It creates a separate test group under `Maps` for each map, and a test for each of the map's locations.
<!-- /Maps -->
<!-- /Development -->