Spec maps for scroll blocks + "implementations"

This commit is contained in:
Florrie 2018-04-30 17:45:32 -03:00
parent 8a9818d0d4
commit 62b8dd93af
2 changed files with 47 additions and 1 deletions

View file

@ -34,7 +34,12 @@ class Scratch3MotionBlocks {
motion_sety: this.setY, motion_sety: this.setY,
motion_xposition: this.getX, motion_xposition: this.getX,
motion_yposition: this.getY, motion_yposition: this.getY,
motion_direction: this.getDirection motion_direction: this.getDirection,
motion_scroll_right: this.doNothing,
motion_scroll_up: this.doNothing,
motion_align_scene: this.doNothing,
motion_xscroll: this.doNothing,
motion_yscroll: this.doNothing
}; };
} }
@ -254,6 +259,8 @@ class Scratch3MotionBlocks {
getDirection (args, util) { getDirection (args, util) {
return util.target.direction; return util.target.direction;
} }
doNothing () {}
} }
module.exports = Scratch3MotionBlocks; module.exports = Scratch3MotionBlocks;

View file

@ -206,6 +206,45 @@ const specMap = {
argMap: [ argMap: [
] ]
}, },
'scrollRight': {
opcode: 'motion_scroll_right',
argMap: [
{
type: 'input',
inputOp: 'math_number',
inputName: 'DISTANCE'
}
]
},
'scrollUp': {
opcode: 'motion_scroll_up',
argMap: [
{
type: 'input',
inputOp: 'math_number',
inputName: 'DISTANCE'
}
]
},
'scrollAlign': {
opcode: 'motion_align_scene',
argMap: [
{
type: 'field',
fieldName: 'ALIGNMENT'
}
]
},
'xScroll': {
opcode: 'motion_xscroll',
argMap: [
]
},
'yScroll': {
opcode: 'motion_yscroll',
argMap: [
]
},
'say:duration:elapsed:from:': { 'say:duration:elapsed:from:': {
opcode: 'looks_sayforsecs', opcode: 'looks_sayforsecs',
argMap: [ argMap: [