Skip to content

Commit 1c207cd

Browse files
Merge pull request code-dot-org#24857 from code-dot-org/levelbuilder
DTS (Levelbuilder > Staging) [robo-dts]
2 parents f4b793e + 6f73f1d commit 1c207cd

File tree

92 files changed

+1494
-496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1494
-496
lines changed

dashboard/config/blocks/Dancelab/Dancelab_changeMove.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
function changeMove(sprite, move) {
22
if (move == "next") {
3-
move = 1 + ((sprite.current_move + 1) % (dancers[sprite.style].length - 1));
3+
move = 1 + ((sprite.current_move + 1) % (ANIMATIONS[sprite.style].length - 1));
44
} else if (move == "prev") {
5-
move = 1 + ((sprite.current_move - 1) % (dancers[sprite.style].length - 1));
5+
move = 1 + ((sprite.current_move - 1) % (ANIMATIONS[sprite.style].length - 1));
66
} else if (move == "rand") {
7-
move = randomNumber(1, dancers[sprite.style].length - 1);
7+
move = sprite.current_move;
8+
while (move == sprite.current_move) {
9+
move = randomNumber(0, ANIMATIONS[sprite.style].length - 1);
10+
}
811
}
912
sprite.changeAnimation("anim" + move);
1013
if (animation.looping) sprite.looping_frame = 0;

dashboard/config/blocks/Dancelab/Dancelab_changeMove.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,25 @@
1212
{
1313
"name": "MOVE",
1414
"options": [
15-
[
16-
"Rest",
17-
"0"
18-
],
1915
[
2016
"Clap High",
21-
"1"
17+
"0"
2218
],
2319
[
2420
"Clown",
25-
"2"
21+
"1"
2622
],
2723
[
2824
"Dab",
29-
"3"
25+
"2"
3026
],
3127
[
3228
"Double Jam",
33-
"4"
29+
"3"
3430
],
3531
[
3632
"Drop",
37-
"5"
33+
"4"
3834
],
3935
[
4036
"Floss",
@@ -45,15 +41,15 @@
4541
"7"
4642
],
4743
[
48-
"Roll",
44+
"Kick",
4945
"8"
5046
],
5147
[
52-
"This or That",
48+
"Roll",
5349
"9"
5450
],
5551
[
56-
"Kick",
52+
"This or That",
5753
"10"
5854
],
5955
[
@@ -71,6 +67,10 @@
7167
[
7268
"Random",
7369
"\"rand\""
70+
],
71+
[
72+
"None",
73+
"8"
7474
]
7575
]
7676
}

dashboard/config/blocks/Dancelab/Dancelab_changeMoveLR.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
function changeMoveLR(sprite, move, dir) {
22
if (move == "next") {
3-
move = 1 + ((sprite.current_move + 1) % (dancers[sprite.style].length - 1));
3+
move = 1 + ((sprite.current_move + 1) % (ANIMATIONS[sprite.style].length - 1));
44
} else if (move == "prev") {
5-
move = 1 + ((sprite.current_move - 1) % (dancers[sprite.style].length - 1));
5+
move = 1 + ((sprite.current_move - 1) % (ANIMATIONS[sprite.style].length - 1));
66
} else if (move == "rand") {
7-
move = randomNumber(1, dancers[sprite.style].length - 1);
7+
// Make sure random switches to a new move
8+
move = sprite.current_move;
9+
while (move == sprite.current_move) {
10+
move = randomNumber(0, ANIMATIONS[sprite.style].length - 1);
11+
}
812
}
913
sprite.mirroring = dir;
1014
sprite.mirrorX(dir);

dashboard/config/blocks/Dancelab/Dancelab_changeMoveLR.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,43 @@
1818
"name": "MOVE",
1919
"options": [
2020
[
21-
"Rest",
21+
"Clap High",
2222
"0"
2323
],
2424
[
25-
"Clap High",
25+
"Clown",
2626
"1"
2727
],
2828
[
29-
"Clown",
29+
"Dab",
3030
"2"
3131
],
3232
[
33-
"Dab",
33+
"Double Jam",
3434
"3"
3535
],
3636
[
37-
"Double Jam",
37+
"Drop",
3838
"4"
3939
],
4040
[
41-
"Drop",
41+
"Floss",
4242
"5"
4343
],
4444
[
45-
"Floss",
45+
"Fresh",
4646
"6"
4747
],
4848
[
49-
"Fresh",
49+
"Kick",
5050
"7"
5151
],
5252
[
5353
"Roll",
54-
"8"
55-
],
56-
[
57-
"This or That",
5854
"9"
5955
],
6056
[
61-
"Kick",
57+
"This or That",
6258
"10"
6359
],
6460
[
@@ -76,6 +72,10 @@
7672
[
7773
"Random",
7874
"\"rand\""
75+
],
76+
[
77+
"None",
78+
"8"
7979
]
8080
]
8181
},

dashboard/config/blocks/Dancelab/Dancelab_doMoveLR.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
function doMoveLR(sprite, move, dir) {
22
if (move == "next") {
3-
move = (sprite.current_move + 1) % dancers[sprite.style].length;
3+
move = (sprite.current_move + 1) % ANIMATIONS[sprite.style].length;
44
} else if (move == "prev") {
5-
move = (sprite.current_move - 1) % dancers[sprite.style].length;
5+
move = (sprite.current_move - 1) % ANIMATIONS[sprite.style].length;
66
} else if (move == "rand") {
7-
move = randomNumber(0, dancers[sprite.style].length - 1);
7+
move = sprite.current_move;
8+
while (move == sprite.current_move) {
9+
move = randomNumber(0, ANIMATIONS[sprite.style].length - 1);
10+
}
811
}
912
sprite.mirrorX(dir);
1013
sprite.changeAnimation("anim" + move);

dashboard/config/blocks/Dancelab/Dancelab_doMoveLR.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,43 @@
1818
"name": "MOVE",
1919
"options": [
2020
[
21-
"Rest",
21+
"Clap High",
2222
"0"
2323
],
2424
[
25-
"Clap High",
25+
"Clown",
2626
"1"
2727
],
2828
[
29-
"Clown",
29+
"Dab",
3030
"2"
3131
],
3232
[
33-
"Dab",
33+
"Double Jam",
3434
"3"
3535
],
3636
[
37-
"Double Jam",
37+
"Drop",
3838
"4"
3939
],
4040
[
41-
"Drop",
41+
"Floss",
4242
"5"
4343
],
4444
[
45-
"Floss",
45+
"Fresh",
4646
"6"
4747
],
4848
[
49-
"Fresh",
49+
"Kick",
5050
"7"
5151
],
5252
[
5353
"Roll",
54-
"8"
55-
],
56-
[
57-
"This or That",
5854
"9"
5955
],
6056
[
61-
"Kick",
57+
"This or That",
6258
"10"
6359
],
6460
[
@@ -76,6 +72,10 @@
7672
[
7773
"Random",
7874
"\"rand\""
75+
],
76+
[
77+
"None",
78+
"8"
7979
]
8080
]
8181
},

dashboard/config/blocks/Dancelab/Dancelab_makeNewDanceSprite.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ function makeNewDanceSprite(costume, name, location) {
1717
sprite.current_move = 0;
1818
sprite.previous_move = 0;
1919

20-
for (var i=0; i < dancers[costume].length; i++) {
21-
sprite.addAnimation("anim" + i, dancers[costume][i]);
20+
for (var i=0; i < ANIMATIONS[costume].length; i++) {
21+
sprite.addAnimation("anim" + i, ANIMATIONS[costume][i].animation);
2222
}
23-
23+
sprite.changeAnimation("anim8");
2424
sprite.animation.stop();
2525
sprites.add(sprite);
2626
sprite.speed = 10;
@@ -45,7 +45,7 @@ function makeNewDanceSprite(costume, name, location) {
4545
}
4646

4747
if (sprite.looping_frame % 48 === 0) {
48-
sprite.mirroring *= -1;
48+
if (ANIMATIONS[sprite.style][sprite.current_move].mirror) sprite.mirroring *= -1;
4949
if (sprite.animation.looping) {
5050
sprite.mirrorX(sprite.mirroring);
5151
}

dashboard/config/blocks/Dancelab/Dancelab_makeNewDanceSprite.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,33 @@
1313
{
1414
"name": "COSTUME",
1515
"options": [
16+
[
17+
"Cat",
18+
"\"CAT\""
19+
],
20+
[
21+
"Dog",
22+
"\"DOG\""
23+
],
1624
[
1725
"Duck",
18-
"\"duck\""
26+
"\"DUCK\""
1927
],
2028
[
2129
"Moose",
22-
"\"moose\""
30+
"\"MOOSE\""
2331
],
2432
[
25-
"Unicorn",
26-
"\"unicorn\""
33+
"Poo",
34+
"\"POO\""
2735
],
2836
[
29-
"MrWiggles",
30-
"\"mrwiggles\""
37+
"Robot",
38+
"\"ROBOT\""
3139
],
3240
[
33-
"Cat",
34-
"\"cat\""
41+
"Shark",
42+
"\"SHARK\""
3543
]
3644
]
3745
},
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"category": "World",
3+
"config": {
4+
"color": [
5+
240,
6+
0.45,
7+
0.65
8+
],
9+
"func": "showScoreboard",
10+
"blockText": "scoreboard label {LABEL} text color {TEXTCOLOR} color {COLOR} value {VALUE} corner {CORNER}",
11+
"args": [
12+
{
13+
"name": "LABEL"
14+
},
15+
{
16+
"name": "TEXTCOLOR",
17+
"type": "Colour"
18+
},
19+
{
20+
"name": "COLOR",
21+
"type": "Colour"
22+
},
23+
{
24+
"name": "VALUE",
25+
"type": "Number"
26+
},
27+
{
28+
"name": "CORNER",
29+
"options": [
30+
[
31+
"right",
32+
"\"right\""
33+
],
34+
[
35+
"left",
36+
"\"left\""
37+
]
38+
]
39+
}
40+
],
41+
"inline": false
42+
}
43+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function newButton() {
2+
button("id", "HEY I'M NEW");
3+
}

0 commit comments

Comments
 (0)