mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Added Random Actions.
This commit is contained in:
parent
304dfe3318
commit
ae18f7ebf2
7 changed files with 86 additions and 1 deletions
13
v3/src/actions/RandomCircle.js
Normal file
13
v3/src/actions/RandomCircle.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Random = require('../geom/circle/Random');
|
||||
|
||||
var RandomCircle = function (items, circle)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
Random(circle, items[i]);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = RandomCircle;
|
13
v3/src/actions/RandomEllipse.js
Normal file
13
v3/src/actions/RandomEllipse.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Random = require('../geom/ellipse/Random');
|
||||
|
||||
var RandomEllipse = function (items, ellipse)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
Random(ellipse, items[i]);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = RandomEllipse;
|
13
v3/src/actions/RandomLine.js
Normal file
13
v3/src/actions/RandomLine.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Random = require('../geom/line/Random');
|
||||
|
||||
var RandomLine = function (items, line)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
Random(line, items[i]);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = RandomLine;
|
13
v3/src/actions/RandomRectangle.js
Normal file
13
v3/src/actions/RandomRectangle.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var Random = require('../geom/rectangle/Random');
|
||||
|
||||
var RandomRectangle = function (items, rect)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
Random(rect, items[i]);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = RandomRectangle;
|
|
@ -9,6 +9,10 @@ module.exports = {
|
|||
IncXY: require('./IncXY'),
|
||||
IncY: require('./IncY'),
|
||||
PositionAroundCircle: require('./PositionAroundCircle'),
|
||||
RandomCircle: require('./RandomCircle'),
|
||||
RandomEllipse: require('./RandomEllipse'),
|
||||
RandomLine: require('./RandomLine'),
|
||||
RandomRectangle: require('./RandomRectangle'),
|
||||
Rotate: require('./Rotate'),
|
||||
RotateAround: require('./RotateAround'),
|
||||
RotateAroundDistance: require('./RotateAroundDistance'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var CHECKSUM = {
|
||||
build: 'b4d4a8d0-13ba-11e7-974b-e96ec5d8ff04'
|
||||
build: '72b30ba0-13be-11e7-bd1a-0b21ce51903e'
|
||||
};
|
||||
module.exports = CHECKSUM;
|
|
@ -101,6 +101,7 @@ var Layer = new Class({
|
|||
createMultiple: function (quantity, key, frame, options)
|
||||
{
|
||||
if (frame === undefined) { frame = null; }
|
||||
// if (options === undefined) { options = {}; }
|
||||
|
||||
var visible = GetObjectValue(options, 'visible', true);
|
||||
|
||||
|
@ -223,6 +224,34 @@ var Layer = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
randomCircle: function (circle)
|
||||
{
|
||||
Actions.RandomCircle(this.children.entries, circle);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
randomEllipse: function (ellipse)
|
||||
{
|
||||
Actions.RandomEllipse(this.children.entries, ellipse);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
randomLine: function (line)
|
||||
{
|
||||
Actions.RandomLine(this.children.entries, line);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
randomRectangle: function (rect)
|
||||
{
|
||||
Actions.RandomRectangle(this.children.entries, rect);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
rotate: function (value)
|
||||
{
|
||||
Actions.Rotate(this.children.entries, value);
|
||||
|
|
Loading…
Reference in a new issue