Skip to content

Commit 6314e44

Browse files
instead of using local storage, variables{} will be used
1 parent 845419c commit 6314e44

1 file changed

Lines changed: 36 additions & 7 deletions

File tree

extensions/motion-expansion.js

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
Scratch.translate.setup({"de":{"_Motion Expansion":"Bewegungserweiterung","_set my home":"setz mein zuhause","_set my home to x: [X] y: [Y]":"setz mein zuhause zur x: [X] y: [Y]","_go to home":"geh zuhause","_move [STEPS] steps towards x: [X] y: [Y]":"gehe [STEPS] er Schritt richtung zur x: [X] y: [Y]","_move [PERCENT]% of the way to x: [X] y: [Y]":"gehe [PERCENT]% auf der weg zur x: [X] y: [Y]","_manually fence":"Verhindern Sie, dass Figuren die Bühne verlassen","_rotation style":"Drehtyp"},"it":{"_Motion Expansion":"Espansione del moto","_set my home":"impostare la mia casa","_set my home to x: [X] y: [Y]":"imposta la mia casa su x: [X] y: [Y]","_go to home":"tornare a casa","_manually fence":"impedisci sprite fuori Stage","_move [PERCENT]% of the way to x: [X] y: [Y]":"percorri [PERCENT]% della distanza da x: [X] y: [Y]","_move [STEPS] steps towards x: [X] y: [Y]":"fai [STEPS] passi verso x: [X] y: [Y]","_rotation style":"stile rotazione","_touching rectangle x1: [X1] y1: [Y1] x2: [X2] y2: [Y2]?":"sta toccando rettangolo x1: [X1] y1: [Y1] x2: [X2] y2: [Y2]","_touching x: [X] y: [Y]?":"sta toccando x: [X] y: [Y]"}});
1+
Scratch.translate.setup({
2+
"de":{
3+
"_Motion Expansion":"Bewegungserweiterung",
4+
"_set my home":"setze mein zuhause",
5+
"_set my home to x: [X] y: [Y]":"setze mein zuhause zum x: [X] y: [Y]",
6+
"_go to home":"geh zuhause",
7+
"_move [STEPS] steps towards x: [X] y: [Y]":"gehe [STEPS] er Schritt richtung zur x: [X] y: [Y]",
8+
"_move [PERCENT]% of the way to x: [X] y: [Y]":"gehe [PERCENT]% auf der weg zur x: [X] y: [Y]",
9+
"_manually fence":"Verhindern Sie, dass Figuren die Bühne verlassen",
10+
"_rotation style":"Drehtyp"
11+
},
12+
"it":{
13+
"_Motion Expansion":"Espansione del moto",
14+
"_set my home":"impostare la mia casa",
15+
"_set my home to x: [X] y: [Y]":"imposta la mia casa su x: [X] y: [Y]",
16+
"_go to home":"tornare a casa",
17+
"_manually fence":"impedisci sprite fuori Stage",
18+
"_move [PERCENT]% of the way to x: [X] y: [Y]":"percorri [PERCENT]% della distanza da x: [X] y: [Y]",
19+
"_move [STEPS] steps towards x: [X] y: [Y]":"fai [STEPS] passi verso x: [X] y: [Y]",
20+
"_rotation style":"stile rotazione",
21+
"_touching rectangle x1: [X1] y1: [Y1] x2: [X2] y2: [Y2]?":"sta toccando rettangolo x1: [X1] y1: [Y1] x2: [X2] y2: [Y2]",
22+
"_touching x: [X] y: [Y]?":"sta toccando x: [X] y: [Y]"
23+
}
24+
});
225

326
(function(Scratch) {
427
'use strict';
@@ -7,6 +30,8 @@ Scratch.translate.setup({"de":{"_Motion Expansion":"Bewegungserweiterung","_set
730
throw new Error("this extension must be run unsandboxed");
831
}
932

33+
const variables = {};
34+
1035
/**
1136
* @param {VM.BlockUtility} util
1237
* @param {unknown} targetName
@@ -219,17 +244,21 @@ Scratch.translate.setup({"de":{"_Motion Expansion":"Bewegungserweiterung","_set
219244
}
220245
motion_setmyHome(_, util){
221246
const target = util.target;
222-
return localStorage.setItem('MOTION-EXPANSION' + 'X-POSITION', this._limitPrecision(target.x)),
223-
localStorage.setItem('MOTION-EXPANSION' + 'Y-POSITION', this._limitPrecision(target.y))
247+
variables["MOTION-EXPANSION-X-POSITION"] = this._limitPrecision(target.x)
248+
variables["MOTION-EXPANSION-Y-POSITION"] = this._limitPrecision(target.y)
249+
//return localStorage.setItem('MOTION-EXPANSION' + 'X-POSITION', this._limitPrecision(target.x)),
250+
//localStorage.setItem('MOTION-EXPANSION' + 'Y-POSITION', this._limitPrecision(target.y))
224251
}
225252
motion_setmyHomeTo(args, util){
226-
return localStorage.setItem('MOTION-EXPANSION' + 'X-POSITION', /*this._limitPrecision*/(args.X)),
227-
localStorage.setItem('MOTION-EXPANSION' + 'Y-POSITION', /*this._limitPrecision*/(args.Y))
253+
//return localStorage.setItem('MOTION-EXPANSION' + 'X-POSITION', /*this._limitPrecision*/(args.X)),
254+
//localStorage.setItem('MOTION-EXPANSION' + 'Y-POSITION', /*this._limitPrecision*/(args.Y))
255+
variables["MOTION-EXPANSION-X-POSITION"] = args.X
256+
variables["MOTION-EXPANSION-Y-POSITION"] = args.Y
228257
}
229258
motion_gotoHome(_, util){
230259
const target = util.target;
231-
let x = localStorage.getItem('MOTION-EXPANSION' + 'X-POSITION');
232-
let y = localStorage.getItem('MOTION-EXPANSION' + 'Y-POSITION');
260+
let x = variables["MOTION-EXPANSION-X-POSITION"]//localStorage.getItem('MOTION-EXPANSION' + 'X-POSITION');
261+
let y = variables["MOTION-EXPANSION-Y-POSITION"]//localStorage.getItem('MOTION-EXPANSION' + 'Y-POSITION');
233262
return target.setXY(x, y);
234263
}
235264
motion_pointawayfrom(args, util) {

0 commit comments

Comments
 (0)