Skip to content

Commit

Permalink
Merge pull request #24142 from code-dot-org/levelbuilder
Browse files Browse the repository at this point in the history
DTS (Levelbuilder > Staging) [robo-dts]
  • Loading branch information
deploy-code-org committed Aug 7, 2018
2 parents e159542 + cc0e764 commit a22b1c1
Show file tree
Hide file tree
Showing 88 changed files with 10,674 additions and 207 deletions.
5 changes: 5 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_atTimestamp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function atTimestamp(timestamp, event) {
registerSetup(function() {
Dance.song.addCue(0, timestamp, event);
});
}
19 changes: 19 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_atTimestamp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"category": "Events",
"config": {
"color": [
140,
1,
0.74
],
"func": "atTimestamp",
"blockText": "at {TIMESTAMP} seconds",
"args": [
{
"name": "TIMESTAMP",
"type": "Number"
}
],
"eventBlock": true
}
}
14 changes: 14 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_changeColorBy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function changeColorBy(input, method, amount) {
push();
colorMode(HSB, 100);
var c = color(input);
var hsb = {
hue: c._getHue(),
saturation: c._getSaturation(),
brightness: c._getBrightness()
};
hsb[method] = Math.round((hsb[method] + amount) % 100);
var new_c = color(hsb.hue, hsb.saturation, hsb.brightness);
pop();
return new_c;
}
35 changes: 35 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_changeColorBy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"category": "World",
"config": {
"func": "changeColorBy",
"blockText": "change {COLOR} {METHOD} by {AMOUNT}",
"returnType": "Colour",
"args": [
{
"name": "COLOR",
"type": "Colour"
},
{
"name": "METHOD",
"options": [
[
"hue",
"\"hue\""
],
[
"saturation",
"\"saturation\""
],
[
"brightness",
"\"brightness\""
]
]
},
{
"name": "AMOUNT",
"type": "Number"
}
]
}
}
18 changes: 18 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_changePropBy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function changePropBy(sprite, property, val) {
if (!sprite || val === undefined) {
return;
}
if (property == "scale") {
sprite.scale += val/100;
if (sprite.scale < 0) {
sprite.scale = 0;
}
} else if (property == "tint") {
sprite.tint = changeColorBy(sprite.tint, "hue", val);
}
else if (property=="direction") {
sprite.direction = getDirection(sprite) + val;
} else {
sprite[property] += val;
}
}
46 changes: 46 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_changePropBy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"category": "Sprites",
"config": {
"func": "changePropBy",
"blockText": "change {SPRITE} {PROPERTY} by {VAL}",
"args": [
{
"name": "SPRITE",
"type": "Sprite"
},
{
"name": "PROPERTY",
"options": [
[
"size",
"\"scale\""
],
[
"rotation",
"\"rotation\""
],
[
"x position",
"\"x\""
],
[
"y position",
"\"y\""
],
[
"movement direction",
"\"direction\""
],
[
"tint",
"\"tint\""
]
]
},
{
"name": "VAL",
"type": "Number"
}
]
}
}
3 changes: 3 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_clickedOn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function clickedOn(sprite, event) {
touchEvents.push({type: mousePressedOver, event: event, sprite: sprite});
}
20 changes: 20 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_clickedOn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"category": "Events",
"config": {
"color": [
140,
1,
0.74
],
"func": "clickedOn",
"blockText": "when {SPRITE} clicked",
"args": [
{
"name": "SPRITE",
"type": "Sprite",
"defer": true
}
],
"eventBlock": true
}
}
13 changes: 13 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_frameRate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"category": "",
"config": {
"func": "frameRate",
"blockText": "set framerate to {RATE}",
"args": [
{
"name": "RATE",
"type": "Number"
}
]
}
}
14 changes: 14 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_getProp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function getProp(sprite, property) {
if (!sprite) {
return undefined;
}
if (property=="scale") {
return sprite.scale*100;
} else if (property=="costume") {
return sprite.getAnimationLabel();
} else if (property=="direction") {
return getDirection(sprite);
} else {
return sprite[property];
}
}
48 changes: 48 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_getProp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"category": "Sprites",
"config": {
"func": "getProp",
"blockText": "{SPRITE} {PROPERTY}",
"returnType": "None",
"color": [
258,
"0.35",
"0.62"
],
"args": [
{
"name": "SPRITE",
"type": "Sprite"
},
{
"name": "PROPERTY",
"options": [
[
"size",
"\"scale\""
],
[
"rotation",
"\"rotation\""
],
[
"x position",
"\"x\""
],
[
"y position",
"\"y\""
],
[
"movement direction",
"\"direction\""
],
[
"tint",
"\"tint\""
]
]
}
]
}
}
20 changes: 20 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_isTouching.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"category": "Logic",
"config": {
"func": "isTouching",
"blockText": "{THIS} is touching {TARGET}",
"args": [
{
"name": "TARGET",
"type": "Sprite"
}
],
"methodCall": true,
"returnType": "Boolean",
"color": [
197,
0.88,
0.78
]
}
}
3 changes: 0 additions & 3 deletions dashboard/config/blocks/Dancelab/Dancelab_mapXlow.js

This file was deleted.

14 changes: 0 additions & 14 deletions dashboard/config/blocks/Dancelab/Dancelab_mapXlow.json

This file was deleted.

3 changes: 0 additions & 3 deletions dashboard/config/blocks/Dancelab/Dancelab_mapXvol.js

This file was deleted.

14 changes: 0 additions & 14 deletions dashboard/config/blocks/Dancelab/Dancelab_mapXvol.json

This file was deleted.

7 changes: 0 additions & 7 deletions dashboard/config/blocks/Dancelab/Dancelab_mapXvol2.js

This file was deleted.

14 changes: 0 additions & 14 deletions dashboard/config/blocks/Dancelab/Dancelab_mapXvol2.json

This file was deleted.

3 changes: 3 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_mixColors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function mixColors(color1, color2) {
return lerpColor(color(color1), color(color2), 0.5);
}
21 changes: 21 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_mixColors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"category": "World",
"config": {
"func": "mixColors",
"blockText": "mix {COLOR1} and {COLOR2}",
"args": [
{
"name": "COLOR1"
},
{
"name": "COLOR2"
}
],
"returnType": "Colour",
"color": [
196,
1,
0.79
]
}
}
16 changes: 16 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_moveDown.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category": "Sprites",
"config": {
"color": [
184,
1,
0.74
],
"func": "moveDown",
"blockText": "{THIS} move down",
"args": [

],
"methodCall": true
}
}
5 changes: 5 additions & 0 deletions dashboard/config/blocks/Dancelab/Dancelab_moveForward.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function moveForward(sprite, distance) {
var direction = getDirection(sprite);
sprite.x += distance * Math.cos(direction * Math.PI / 180);
sprite.y += distance * Math.sin(direction * Math.PI / 180);
}

0 comments on commit a22b1c1

Please sign in to comment.