kopia lustrzana https://github.com/backface/turtlestitch
added new POSITION primitive block to the MOTION category
rodzic
4dfcdc7eef
commit
270a987276
|
@ -6,6 +6,7 @@
|
|||
* export script (including dependencies) via its context menu
|
||||
* export / import sprite-local custom block definitions from the palette
|
||||
* added "combinations" primitive to the palette
|
||||
* new POSITION primitive reporter in the MOTION category
|
||||
* new "position" choice in OF reporter's attribute dropdown, reports a list of XY coordinates
|
||||
* new "Tad" costume series, thanks, Meghan and Brian!
|
||||
* **Notable Changes:**
|
||||
|
@ -31,6 +32,7 @@
|
|||
* threads, objects: new menu functionality for ASK command, when passing a list
|
||||
* objects: support various data types inside menus (sprites, costumes, blocks)
|
||||
* objects: wrap long texts inside menus into several lines
|
||||
* objects: added new POSITION primitive block to the MOTION category
|
||||
|
||||
### 2022-03-28
|
||||
* new "Tad" turtle costumes, thanks, Meghan and Brian!
|
||||
|
|
|
@ -301,6 +301,12 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
category: 'motion',
|
||||
spec: 'if on edge, bounce'
|
||||
},
|
||||
getPosition: {
|
||||
only: SpriteMorph,
|
||||
type: 'reporter',
|
||||
category: 'motion',
|
||||
spec: 'position'
|
||||
},
|
||||
xPosition: {
|
||||
only: SpriteMorph,
|
||||
type: 'reporter',
|
||||
|
@ -1733,8 +1739,9 @@ SpriteMorph.prototype.blockAlternatives = {
|
|||
changeYPosition: ['changeXPosition', 'setYPosition', 'setXPosition',
|
||||
'forward'],
|
||||
setYPosition: ['setXPosition', 'changeYPosition', 'changeXPosition'],
|
||||
xPosition: ['yPosition'],
|
||||
yPosition: ['xPosition'],
|
||||
xPosition: ['yPosition', 'getPosition'],
|
||||
yPosition: ['xPosition', 'getPosition'],
|
||||
getPosition: ['xPosition', 'yPosition'],
|
||||
|
||||
// looks:
|
||||
doSayFor: ['doThinkFor', 'bubble', 'doThink', 'doAsk'],
|
||||
|
@ -2459,6 +2466,7 @@ SpriteMorph.prototype.blockTemplates = function (
|
|||
blocks.push('-');
|
||||
blocks.push(block('bounceOffEdge'));
|
||||
blocks.push('-');
|
||||
blocks.push(block('getPosition'));
|
||||
blocks.push(watcherToggle('xPosition'));
|
||||
blocks.push(block('xPosition', this.inheritsAttribute('x position')));
|
||||
blocks.push(watcherToggle('yPosition'));
|
||||
|
@ -6079,6 +6087,10 @@ SpriteMorph.prototype.turnLeft = function (degrees) {
|
|||
this.setHeading(this.heading - (+degrees || 0));
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.getPosition = function () {
|
||||
return new List([this.xPosition(), this.yPosition()]);
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.xPosition = function () {
|
||||
if (this.inheritsAttribute('x position')) {
|
||||
return this.exemplar.xPosition();
|
||||
|
|
Ładowanie…
Reference in New Issue