mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-25 13:39:06 -05:00
added default scale to sprites
This commit is contained in:
parent
203179d526
commit
473e7de6e0
4 changed files with 8 additions and 9 deletions
|
@ -627,9 +627,7 @@
|
|||
render: {
|
||||
strokeStyle: '#ffffff',
|
||||
sprite: {
|
||||
texture: './img/box.png',
|
||||
xScale: 1,
|
||||
yScale: 1
|
||||
texture: './img/box.png'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -641,9 +639,7 @@
|
|||
friction: 0.01,
|
||||
render: {
|
||||
sprite: {
|
||||
texture: './img/ball.png',
|
||||
xScale: 1,
|
||||
yScale: 1
|
||||
texture: './img/ball.png'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -43,7 +43,10 @@ var Body = {};
|
|||
slop: 0.05,
|
||||
render: {
|
||||
visible: true,
|
||||
sprite: null,
|
||||
sprite: {
|
||||
xScale: 1,
|
||||
yScale: 1
|
||||
},
|
||||
path: 'L 0 0 L 40 0 L 40 40 L 0 40',
|
||||
lineWidth: 1.5
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ var Render = {};
|
|||
if (!body.render.visible)
|
||||
continue;
|
||||
|
||||
if (body.render.sprite && !options.wireframes) {
|
||||
if (body.render.sprite && body.render.sprite.texture && !options.wireframes) {
|
||||
// body sprite
|
||||
var sprite = body.render.sprite,
|
||||
texture = _getTexture(render, sprite.texture);
|
||||
|
|
|
@ -239,7 +239,7 @@ var RenderPixi = {};
|
|||
if (!bodyRender.visible)
|
||||
return;
|
||||
|
||||
if (bodyRender.sprite) {
|
||||
if (bodyRender.sprite && bodyRender.sprite.texture) {
|
||||
var spriteId = 'b-' + body.id,
|
||||
sprite = render.sprites[spriteId],
|
||||
spriteBatch = render.spriteBatch;
|
||||
|
|
Loading…
Reference in a new issue