Merge pull request #1079 from thisandagain/bugfix/1072

Various refinements to Video Motion extension
This commit is contained in:
Andrew Sliwinski authored and GitHub committed 2018-04-23 17:04:17 -04:00
commit eeab0695d6
1 file changed
+22 -18
+22 -18
View File
@@ -289,13 +289,13 @@ class Scratch3VideoSensingBlocks {
*/
get SUBJECT_INFO () {
return [
{
name: 'stage',
value: SensingSubject.STAGE
},
{
name: 'sprite',
value: SensingSubject.SPRITE
},
{
name: 'stage',
value: SensingSubject.STAGE
}
];
}
@@ -336,10 +336,27 @@ class Scratch3VideoSensingBlocks {
* @returns {object} metadata for this extension and its blocks.
*/
getInfo () {
// Enable the video layer
this.runtime.ioDevices.video.enableVideo();
// Return extension definition
return {
id: 'videoSensing',
name: 'Video Motion',
blocks: [
{
// @todo this hat needs to be set itself to restart existing
// threads like Scratch 2's behaviour.
opcode: 'whenMotionGreaterThan',
text: 'when video motion > [REFERENCE]',
blockType: BlockType.HAT,
arguments: {
REFERENCE: {
type: ArgumentType.NUMBER,
defaultValue: 10
}
}
},
{
opcode: 'videoOn',
blockType: BlockType.REPORTER,
@@ -353,20 +370,7 @@ class Scratch3VideoSensingBlocks {
SUBJECT: {
type: ArgumentType.NUMBER,
menu: 'SUBJECT',
defaultValue: SensingSubject.STAGE
}
}
},
{
// @todo this hat needs to be set itself to restart existing
// threads like Scratch 2's behaviour.
opcode: 'whenMotionGreaterThan',
text: 'when video motion > [REFERENCE]',
blockType: BlockType.HAT,
arguments: {
REFERENCE: {
type: ArgumentType.NUMBER,
defaultValue: 10
defaultValue: SensingSubject.SPRITE
}
}
},