Skip to content

Commit

Permalink
fix: Load images using data-url. Also reduces space
Browse files Browse the repository at this point in the history
  • Loading branch information
johnedvard committed Aug 20, 2022
1 parent 4603529 commit bf9889b
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 93 deletions.
181 changes: 96 additions & 85 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"build": "rm -rf dist && parcel build src/index.html",
"zip": "cd dist && zip game.zip *.png *.html *.css *.js static/level/*.json",
"build:zip": "npm run build && cd dist && zip game.zip *.png *.html *.css *.js static/level/*.json",
"build:roadroller": "npm run build && roadroller dist/index.*.js -o dist/index.*.js && npm run zip"
"build:roadroller": "npm run build && roadroller dist/index.*.js -o dist/index.*.js && npm run zip",
"roadroller": "roadroller dist/index.*.js -o dist/index.*.js"
},
"author": "johnedvard",
"license": "ISC",
"devDependencies": {
"@parcel/compressor-brotli": "^2.7.0",
"@parcel/compressor-gzip": "^2.7.0",
"@parcel/reporter-bundle-analyzer": "^2.7.0",
"@parcel/optimizer-data-url": "^2.7.0",
"@parcel/transformer-inline-string": "^2.7.0",
"parcel": "^2.7.0",
"parcel-reporter-static-files-copy": "^1.4.0",
"roadroller": "^2.1.0"
Expand Down
3 changes: 2 additions & 1 deletion src/Goal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as grave from 'data-url:./assets/img/grave-4x-mini.png';

import { Sprite } from 'kontra';

import { isBoxCollision } from './utils';
import grave from './assets/img/grave-4x-mini.png';

export class Goal {
level;
Expand Down
2 changes: 1 addition & 1 deletion src/Player.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import skull from './assets/img/skull.png';
import skull from 'data-url:./assets/img/skull.png';

import { getPointer, Sprite } from 'kontra';
import { PlayerControls } from './PlayerControls';
Expand Down
4 changes: 2 additions & 2 deletions src/Saw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import saw2 from './assets/img/saw3.png';
import saw from './assets/img/saw3.png';
import saw2 from 'data-url:./assets/img/saw3.png';

import { Sprite } from 'kontra';
import { BACK_FORTH, UP_DOWN } from './sawBehavior';

Expand Down

0 comments on commit bf9889b

Please sign in to comment.