littlejsengine 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/{build → dist}/littlejs.d.ts +25 -20
- package/{build → dist}/littlejs.esm.js +160 -61
- package/dist/littlejs.esm.min.js +1 -0
- package/{build → dist}/littlejs.js +160 -61
- package/dist/littlejs.min.js +1 -0
- package/{build → dist}/littlejs.release.js +154 -59
- package/examples/breakout/game.js +2 -2
- package/examples/breakout/gameObjects.js +3 -3
- package/examples/breakout/index.html +3 -3
- package/examples/breakoutTutorial/index.html +2 -2
- package/examples/electron/build.js +1 -1
- package/examples/electron/game.js +49 -38
- package/examples/electron/index.html +2 -2
- package/examples/electron/tiles.png +0 -0
- package/examples/empty/index.html +1 -1
- package/examples/js13k/build.js +1 -1
- package/examples/js13k/game.js +10 -9
- package/examples/js13k/index.html +13 -13
- package/examples/js13k/tiles.png +0 -0
- package/examples/module/game.js +45 -41
- package/examples/module/index.html +1 -1
- package/examples/module/tiles.png +0 -0
- package/examples/particles/index.html +1 -1
- package/examples/platformer/data/gameTileData.tmx +143 -0
- package/examples/platformer/data/gameTileData.tsx +4 -0
- package/examples/platformer/game.js +0 -1
- package/examples/platformer/gameCharacter.js +1 -1
- package/examples/platformer/gameEffects.js +42 -110
- package/examples/platformer/gameLevel.js +149 -183
- package/examples/platformer/gameObjects.js +61 -16
- package/examples/platformer/gamePlayer.js +3 -2
- package/examples/platformer/gameTileData.js +181 -0
- package/examples/platformer/index.html +8 -7
- package/examples/platformer/tiles.png +0 -0
- package/examples/platformer/tilesLevel.png +0 -0
- package/examples/puzzle/game.js +12 -12
- package/examples/puzzle/index.html +2 -2
- package/examples/starter/build.js +1 -1
- package/examples/starter/game.js +6 -6
- package/examples/starter/index.html +13 -13
- package/examples/starter/tiles.png +0 -0
- package/examples/stress/index.html +1 -1
- package/examples/typescript/build.bat +4 -1
- package/examples/typescript/game.js +34 -31
- package/examples/typescript/game.ts +40 -36
- package/examples/typescript/index.html +1 -1
- package/examples/typescript/tiles.png +0 -0
- package/package.json +3 -3
- package/src/engine.js +1 -1
- package/src/engineAudio.js +4 -10
- package/src/engineBuild.js +9 -2
- package/src/engineDebug.js +6 -2
- package/src/engineInput.js +4 -4
- package/src/engineMedals.js +2 -2
- package/src/engineParticles.js +5 -5
- package/src/engineTileLayer.js +1 -1
- package/src/engineUtilities.js +136 -35
- package/src/engineWebGL.js +1 -1
- package/build/littlejs.esm.min.js +0 -1
- package/build/littlejs.min.js +0 -1
- package/index.d.ts +0 -2094
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Little TypeScript Demo
|
|
2
|
+
Little JS TypeScript Demo
|
|
3
3
|
- A simple starter project
|
|
4
|
-
-
|
|
4
|
+
- Shows how to use LittleJS with TypeScript
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
// import module
|
|
8
|
-
import * as LittleJS from '../../
|
|
9
|
-
const { Vector2, Color, Timer, vec2,
|
|
8
|
+
import * as LittleJS from '../../dist/littlejs.esm.js';
|
|
9
|
+
const { Vector2, Color, Timer, tile, vec2, hsl, rgb } = LittleJS;
|
|
10
10
|
// show the LittleJS splash screen
|
|
11
11
|
LittleJS.setShowSplashScreen(true);
|
|
12
12
|
// sound effects
|
|
@@ -16,51 +16,52 @@ const medal_example = new LittleJS.Medal(0, 'Example Medal', 'Welcome to LittleJ
|
|
|
16
16
|
LittleJS.medalsInit('Hello World');
|
|
17
17
|
// game variables
|
|
18
18
|
let particleEmitter;
|
|
19
|
-
let gameTimer = new Timer;
|
|
20
19
|
///////////////////////////////////////////////////////////////////////////////
|
|
21
20
|
function gameInit() {
|
|
22
21
|
// create tile collision and visible tile layer
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
22
|
+
const tileCollisionSize = vec2(32, 16);
|
|
23
|
+
LittleJS.initTileCollision(tileCollisionSize);
|
|
24
|
+
const pos = vec2();
|
|
25
|
+
const tileLayer = new LittleJS.TileLayer(pos, tileCollisionSize);
|
|
26
26
|
// get level data from the tiles image
|
|
27
|
-
const imageLevelDataRow = 1;
|
|
28
27
|
const mainContext = LittleJS.mainContext;
|
|
29
28
|
const tileImage = LittleJS.textureInfos[0].image;
|
|
30
29
|
mainContext.drawImage(tileImage, 0, 0);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
const imageData = mainContext.getImageData(0, 0, tileImage.width, tileImage.height).data;
|
|
31
|
+
for (pos.x = tileCollisionSize.x; pos.x--;)
|
|
32
|
+
for (pos.y = tileCollisionSize.y; pos.y--;) {
|
|
33
|
+
// check if this pixel is set
|
|
34
|
+
const i = pos.x + tileImage.width * (15 + tileCollisionSize.y - pos.y);
|
|
35
|
+
if (!imageData[4 * i])
|
|
36
|
+
continue;
|
|
37
|
+
// set tile data
|
|
38
|
+
const tileIndex = 1;
|
|
39
|
+
const direction = LittleJS.randInt(4);
|
|
40
|
+
const mirror = !LittleJS.randInt(2);
|
|
41
|
+
const color = LittleJS.randColor();
|
|
42
|
+
const data = new LittleJS.TileLayerData(tileIndex, direction, mirror, color);
|
|
43
|
+
tileLayer.setData(pos, data);
|
|
44
|
+
LittleJS.setTileCollisionData(pos, 1);
|
|
43
45
|
}
|
|
46
|
+
// draw tile layer with new data
|
|
44
47
|
tileLayer.redraw();
|
|
45
48
|
// move camera to center of collision
|
|
46
|
-
LittleJS.setCameraPos(
|
|
49
|
+
LittleJS.setCameraPos(tileCollisionSize.scale(.5));
|
|
50
|
+
LittleJS.setCameraScale(48);
|
|
47
51
|
// enable gravity
|
|
48
52
|
LittleJS.setGravity(-.01);
|
|
49
53
|
// create particle emitter
|
|
50
|
-
|
|
51
|
-
particleEmitter = new LittleJS.ParticleEmitter(center, 0, // emitPos, emitAngle
|
|
54
|
+
particleEmitter = new LittleJS.ParticleEmitter(vec2(16, 9), 0, // emitPos, emitAngle
|
|
52
55
|
1, 0, 500, Math.PI, // emitSize, emitTime, emitRate, emiteCone
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
tile(0, 16), // tileIndex, tileSize
|
|
57
|
+
hsl(1, 1, 1), hsl(0, 0, 0), // colorStartA, colorStartB
|
|
58
|
+
hsl(0, 0, 0, 0), hsl(0, 0, 0, 0), // colorEndA, colorEndB
|
|
56
59
|
2, .2, .2, .1, .05, // time, sizeStart, sizeEnd, speed, angleSpeed
|
|
57
60
|
.99, 1, 1, Math.PI, // damping, angleDamping, gravityScale, cone
|
|
58
61
|
.05, .5, true, true // fadeRate, randomness, collide, additive
|
|
59
62
|
);
|
|
60
63
|
particleEmitter.elasticity = .3; // bounce when it collides
|
|
61
64
|
particleEmitter.trailScale = 2; // stretch in direction of motion
|
|
62
|
-
// start the game timer
|
|
63
|
-
gameTimer.set();
|
|
64
65
|
}
|
|
65
66
|
///////////////////////////////////////////////////////////////////////////////
|
|
66
67
|
function gameUpdate() {
|
|
@@ -68,7 +69,7 @@ function gameUpdate() {
|
|
|
68
69
|
// play sound when mouse is pressed
|
|
69
70
|
sound_click.play(LittleJS.mousePos);
|
|
70
71
|
// change particle color and set to fade out
|
|
71
|
-
particleEmitter.colorStartA =
|
|
72
|
+
particleEmitter.colorStartA = hsl();
|
|
72
73
|
particleEmitter.colorStartB = LittleJS.randColor();
|
|
73
74
|
particleEmitter.colorEndA = particleEmitter.colorStartA.scale(1, 0);
|
|
74
75
|
particleEmitter.colorEndB = particleEmitter.colorStartB.scale(1, 0);
|
|
@@ -85,7 +86,9 @@ function gameUpdatePost() {
|
|
|
85
86
|
///////////////////////////////////////////////////////////////////////////////
|
|
86
87
|
function gameRender() {
|
|
87
88
|
// draw a grey square in the background without using webgl
|
|
88
|
-
LittleJS.drawRect(
|
|
89
|
+
LittleJS.drawRect(vec2(16, 8), vec2(20, 14), hsl(0, 0, .6), 0, false);
|
|
90
|
+
// draw the logo as a tile
|
|
91
|
+
LittleJS.drawTile(vec2(21, 5), vec2(4.5), tile(3, 128));
|
|
89
92
|
}
|
|
90
93
|
///////////////////////////////////////////////////////////////////////////////
|
|
91
94
|
function gameRenderPost() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Little TypeScript Demo
|
|
2
|
+
Little JS TypeScript Demo
|
|
3
3
|
- A simple starter project
|
|
4
|
-
-
|
|
4
|
+
- Shows how to use LittleJS with TypeScript
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
// import module
|
|
10
|
-
import * as LittleJS from '../../
|
|
11
|
-
const {Vector2, Color, Timer, vec2,
|
|
10
|
+
import * as LittleJS from '../../dist/littlejs.esm.js';
|
|
11
|
+
const {Vector2, Color, Timer, tile, vec2, hsl, rgb} = LittleJS;
|
|
12
12
|
|
|
13
13
|
// show the LittleJS splash screen
|
|
14
14
|
LittleJS.setShowSplashScreen(true);
|
|
@@ -21,62 +21,63 @@ const medal_example = new LittleJS.Medal(0, 'Example Medal', 'Welcome to LittleJ
|
|
|
21
21
|
LittleJS.medalsInit('Hello World');
|
|
22
22
|
|
|
23
23
|
// game variables
|
|
24
|
-
let particleEmitter
|
|
25
|
-
let gameTimer = new Timer;
|
|
24
|
+
let particleEmitter;
|
|
26
25
|
|
|
27
26
|
///////////////////////////////////////////////////////////////////////////////
|
|
28
27
|
function gameInit()
|
|
29
28
|
{
|
|
30
29
|
// create tile collision and visible tile layer
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
30
|
+
const tileCollisionSize = vec2(32, 16);
|
|
31
|
+
LittleJS.initTileCollision(tileCollisionSize);
|
|
32
|
+
const pos = vec2();
|
|
33
|
+
const tileLayer = new LittleJS.TileLayer(pos, tileCollisionSize);
|
|
34
34
|
|
|
35
35
|
// get level data from the tiles image
|
|
36
|
-
const imageLevelDataRow = 1;
|
|
37
36
|
const mainContext = LittleJS.mainContext;
|
|
38
37
|
const tileImage = LittleJS.textureInfos[0].image;
|
|
39
38
|
mainContext.drawImage(tileImage, 0, 0);
|
|
40
|
-
|
|
41
|
-
for (pos.
|
|
39
|
+
const imageData = mainContext.getImageData(0,0,tileImage.width,tileImage.height).data;
|
|
40
|
+
for (pos.x = tileCollisionSize.x; pos.x--;)
|
|
41
|
+
for (pos.y = tileCollisionSize.y; pos.y--;)
|
|
42
42
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
// check if this pixel is set
|
|
44
|
+
const i = pos.x + tileImage.width*(15 + tileCollisionSize.y - pos.y);
|
|
45
|
+
if (!imageData[4*i])
|
|
46
|
+
continue;
|
|
47
|
+
|
|
48
|
+
// set tile data
|
|
49
|
+
const tileIndex = 1;
|
|
50
|
+
const direction = LittleJS.randInt(4)
|
|
51
|
+
const mirror = !LittleJS.randInt(2);
|
|
52
|
+
const color = LittleJS.randColor();
|
|
53
|
+
const data = new LittleJS.TileLayerData(tileIndex, direction, mirror, color);
|
|
54
|
+
tileLayer.setData(pos, data);
|
|
55
|
+
LittleJS.setTileCollisionData(pos, 1);
|
|
54
56
|
}
|
|
57
|
+
|
|
58
|
+
// draw tile layer with new data
|
|
55
59
|
tileLayer.redraw();
|
|
56
60
|
|
|
57
61
|
// move camera to center of collision
|
|
58
|
-
LittleJS.setCameraPos(
|
|
62
|
+
LittleJS.setCameraPos(tileCollisionSize.scale(.5));
|
|
63
|
+
LittleJS.setCameraScale(48);
|
|
59
64
|
|
|
60
65
|
// enable gravity
|
|
61
66
|
LittleJS.setGravity(-.01);
|
|
62
67
|
|
|
63
68
|
// create particle emitter
|
|
64
|
-
const center = LittleJS.tileCollisionSize.scale(.5).add(vec2(0,9));
|
|
65
69
|
particleEmitter = new LittleJS.ParticleEmitter(
|
|
66
|
-
|
|
67
|
-
1, 0, 500, Math.PI,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
vec2(16,9), 0, // emitPos, emitAngle
|
|
71
|
+
1, 0, 500, Math.PI, // emitSize, emitTime, emitRate, emiteCone
|
|
72
|
+
tile(0, 16), // tileIndex, tileSize
|
|
73
|
+
hsl(1,1,1), hsl(0,0,0), // colorStartA, colorStartB
|
|
74
|
+
hsl(0,0,0,0), hsl(0,0,0,0), // colorEndA, colorEndB
|
|
71
75
|
2, .2, .2, .1, .05, // time, sizeStart, sizeEnd, speed, angleSpeed
|
|
72
76
|
.99, 1, 1, Math.PI, // damping, angleDamping, gravityScale, cone
|
|
73
|
-
.05, .5, true, true
|
|
77
|
+
.05, .5, true, true // fadeRate, randomness, collide, additive
|
|
74
78
|
);
|
|
75
79
|
particleEmitter.elasticity = .3; // bounce when it collides
|
|
76
80
|
particleEmitter.trailScale = 2; // stretch in direction of motion
|
|
77
|
-
|
|
78
|
-
// start the game timer
|
|
79
|
-
gameTimer.set();
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -88,7 +89,7 @@ function gameUpdate()
|
|
|
88
89
|
sound_click.play(LittleJS.mousePos);
|
|
89
90
|
|
|
90
91
|
// change particle color and set to fade out
|
|
91
|
-
particleEmitter.colorStartA =
|
|
92
|
+
particleEmitter.colorStartA = hsl();
|
|
92
93
|
particleEmitter.colorStartB = LittleJS.randColor();
|
|
93
94
|
particleEmitter.colorEndA = particleEmitter.colorStartA.scale(1,0);
|
|
94
95
|
particleEmitter.colorEndB = particleEmitter.colorStartB.scale(1,0);
|
|
@@ -112,7 +113,10 @@ function gameUpdatePost()
|
|
|
112
113
|
function gameRender()
|
|
113
114
|
{
|
|
114
115
|
// draw a grey square in the background without using webgl
|
|
115
|
-
LittleJS.drawRect(
|
|
116
|
+
LittleJS.drawRect(vec2(16,8), vec2(20,14), hsl(0,0,.6), 0, false);
|
|
117
|
+
|
|
118
|
+
// draw the logo as a tile
|
|
119
|
+
LittleJS.drawTile(vec2(21,5), vec2(4.5), tile(3,128));
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
///////////////////////////////////////////////////////////////////////////////
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "littlejsengine",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "LittleJS - Tiny and Fast HTML5 Game Engine",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "dist/littlejs.esm.js",
|
|
6
|
+
"types": "dist/littlejs.d.ts",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/KilledByAPixel/LittleJS.git"
|
package/src/engine.js
CHANGED
package/src/engineAudio.js
CHANGED
|
@@ -146,22 +146,19 @@ class SoundWave extends Sound
|
|
|
146
146
|
this.randomness = randomness;
|
|
147
147
|
|
|
148
148
|
if (!soundEnable) return;
|
|
149
|
-
if (!soundDecoderContext)
|
|
150
|
-
soundDecoderContext = new AudioContext;
|
|
151
149
|
|
|
152
150
|
fetch(filename)
|
|
153
151
|
.then(response => response.arrayBuffer())
|
|
154
|
-
.then(arrayBuffer =>
|
|
152
|
+
.then(arrayBuffer => audioContext.decodeAudioData(arrayBuffer))
|
|
155
153
|
.then(audioBuffer =>
|
|
156
154
|
{
|
|
157
155
|
this.sampleChannels = [];
|
|
158
156
|
for (let i = audioBuffer.numberOfChannels; i--;)
|
|
159
|
-
this.sampleChannels[i] = audioBuffer.getChannelData(i);
|
|
157
|
+
this.sampleChannels[i] = Array.from(audioBuffer.getChannelData(i));
|
|
160
158
|
this.sampleRate = audioBuffer.sampleRate;
|
|
161
159
|
});
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
|
-
let soundDecoderContext; // audio context used only to decode audio files
|
|
165
162
|
|
|
166
163
|
/**
|
|
167
164
|
* Music Object - Stores a zzfx music track for later use
|
|
@@ -275,8 +272,9 @@ function getNoteFrequency(semitoneOffset, rootFrequency=220)
|
|
|
275
272
|
///////////////////////////////////////////////////////////////////////////////
|
|
276
273
|
|
|
277
274
|
/** Audio context used by the engine
|
|
275
|
+
* @type {AudioContext}
|
|
278
276
|
* @memberof Audio */
|
|
279
|
-
let audioContext;
|
|
277
|
+
let audioContext = new AudioContext;
|
|
280
278
|
|
|
281
279
|
/** Play cached audio samples with given settings
|
|
282
280
|
* @param {Array} sampleChannels - Array of arrays of samples to play (for stereo playback)
|
|
@@ -291,10 +289,6 @@ function playSamples(sampleChannels, volume=1, rate=1, pan=0, loop=false, sample
|
|
|
291
289
|
{
|
|
292
290
|
if (!soundEnable) return;
|
|
293
291
|
|
|
294
|
-
// create audio context if needed
|
|
295
|
-
if (!audioContext)
|
|
296
|
-
audioContext = new AudioContext;
|
|
297
|
-
|
|
298
292
|
// prevent sounds from building up if they can't be played
|
|
299
293
|
if (audioContext.state != 'running')
|
|
300
294
|
{
|
package/src/engineBuild.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
const ENGINE_NAME = 'littlejs';
|
|
14
|
-
const BUILD_FOLDER = '
|
|
14
|
+
const BUILD_FOLDER = 'dist';
|
|
15
15
|
const SOURCE_FOLDER = 'src';
|
|
16
16
|
const engineSourceFiles =
|
|
17
17
|
[
|
|
@@ -158,7 +158,14 @@ function typeScriptBuildStep(filename)
|
|
|
158
158
|
{
|
|
159
159
|
try
|
|
160
160
|
{
|
|
161
|
-
|
|
161
|
+
const tsFilename = `${BUILD_FOLDER}/${ENGINE_NAME}.d.ts`
|
|
162
|
+
child_process.execSync(`npx tsc ${filename} --declaration --allowJs --emitDeclarationOnly --outFile ${tsFilename}`);
|
|
163
|
+
|
|
164
|
+
// Remove declare module part
|
|
165
|
+
//let fileContent = fs.readFileSync(tsFilename, 'utf8');
|
|
166
|
+
//const r = new RegExp(`declare module "${ENGINE_NAME}\.esm" \{([\\s\\S]*?)\}`);
|
|
167
|
+
//fs.writeFileSync(tsFilename, fileContent.replace(r, '$1'));
|
|
168
|
+
|
|
162
169
|
}
|
|
163
170
|
catch (e) { handleError(e, 'Failed to run TypeScript build step!'); }
|
|
164
171
|
};
|
package/src/engineDebug.js
CHANGED
|
@@ -54,9 +54,13 @@ let debugPrimitives = [], debugPhysics = false, debugRaycast = false, debugParti
|
|
|
54
54
|
|
|
55
55
|
/** Asserts if the experssion is false, does not do anything in release builds
|
|
56
56
|
* @param {Boolean} assert
|
|
57
|
-
* @param {Object} output
|
|
57
|
+
* @param {Object} [output]
|
|
58
58
|
* @memberof Debug */
|
|
59
|
-
function ASSERT(assert, output)
|
|
59
|
+
function ASSERT(assert, output)
|
|
60
|
+
{
|
|
61
|
+
if (enableAsserts)
|
|
62
|
+
output ? console.assert(assert, output) : console.assert(assert);
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
/** Draw a debug rectangle in world space
|
|
62
66
|
* @param {Vector2} pos
|
package/src/engineInput.js
CHANGED
|
@@ -314,9 +314,9 @@ if (isTouchDevice)
|
|
|
314
314
|
// handle all touch events the same way
|
|
315
315
|
ontouchstart = ontouchmove = ontouchend = (e)=>
|
|
316
316
|
{
|
|
317
|
-
// fix stalled audio
|
|
318
|
-
if (soundEnable)
|
|
319
|
-
|
|
317
|
+
// fix stalled audio requiring user interaction
|
|
318
|
+
if (soundEnable && audioContext && audioContext.state != 'running')
|
|
319
|
+
zzfx(0);
|
|
320
320
|
|
|
321
321
|
// check if touching and pass to mouse events
|
|
322
322
|
const touching = e.touches.length;
|
|
@@ -462,7 +462,7 @@ function touchGamepadRender()
|
|
|
462
462
|
const rightCenter = vec2(mainCanvasSize.x-touchGamepadSize, mainCanvasSize.y-touchGamepadSize);
|
|
463
463
|
for (let i=4; i--;)
|
|
464
464
|
{
|
|
465
|
-
const pos = rightCenter.add(vec2().
|
|
465
|
+
const pos = rightCenter.add(vec2().setDirection(i, touchGamepadSize/2));
|
|
466
466
|
overlayContext.fillStyle = touchGamepadButtons[i] ? '#fff' : '#000';
|
|
467
467
|
overlayContext.beginPath();
|
|
468
468
|
overlayContext.arc(pos.x, pos.y, touchGamepadSize/4, 0,9);
|
package/src/engineMedals.js
CHANGED
|
@@ -90,8 +90,8 @@ class Medal
|
|
|
90
90
|
// draw containing rect and clip to that region
|
|
91
91
|
context.save();
|
|
92
92
|
context.beginPath();
|
|
93
|
-
context.fillStyle =
|
|
94
|
-
context.strokeStyle =
|
|
93
|
+
context.fillStyle = new Color(.9,.9,.9).toString();
|
|
94
|
+
context.strokeStyle = new Color(0,0,0).toString();
|
|
95
95
|
context.lineWidth = 3;
|
|
96
96
|
context.rect(x, y, width, medalDisplaySize.y);
|
|
97
97
|
context.fill();
|
package/src/engineParticles.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* @example
|
|
11
11
|
* // create a particle emitter
|
|
12
12
|
* let pos = vec2(2,3);
|
|
13
|
-
* let
|
|
13
|
+
* let particleEmitter = new ParticleEmitter
|
|
14
14
|
* (
|
|
15
|
-
* pos, 0, 1, 0, 500, PI,
|
|
16
|
-
* tile(0, 16),
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
|
|
16
|
+
* tile(0, 16), // tileInfo
|
|
17
|
+
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
|
|
18
|
+
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
|
|
19
19
|
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
|
|
20
20
|
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
|
|
21
21
|
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
|
package/src/engineTileLayer.js
CHANGED
|
@@ -138,7 +138,7 @@ class TileLayerData
|
|
|
138
138
|
* @param {Number} [direction] - Integer direction of tile, in 90 degree increments
|
|
139
139
|
* @param {Boolean} [mirror] - If the tile should be mirrored along the x axis
|
|
140
140
|
* @param {Color} [color] - Color of the tile */
|
|
141
|
-
constructor(tile, direction=0, mirror=false, color=new Color
|
|
141
|
+
constructor(tile, direction=0, mirror=false, color=new Color)
|
|
142
142
|
{
|
|
143
143
|
/** @property {Number} - The tile to use, untextured if undefined */
|
|
144
144
|
this.tile = tile;
|