@robotical/martyblocksjr 4.2.5 → 4.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editions/free/src/app.bundle.js +1 -1
- package/editions/free/src/localizations/bg.json +3 -1
- package/editions/free/src/localizations/ca.json +3 -1
- package/editions/free/src/localizations/cs.json +3 -1
- package/editions/free/src/localizations/cy.json +3 -1
- package/editions/free/src/localizations/da.json +3 -1
- package/editions/free/src/localizations/de.json +3 -1
- package/editions/free/src/localizations/el.json +3 -1
- package/editions/free/src/localizations/en.json +3 -1
- package/editions/free/src/localizations/es.json +3 -1
- package/editions/free/src/localizations/fi.json +3 -1
- package/editions/free/src/localizations/fr.json +3 -1
- package/editions/free/src/localizations/it.json +3 -1
- package/editions/free/src/localizations/ja.json +3 -1
- package/editions/free/src/localizations/ko.json +3 -1
- package/editions/free/src/localizations/nl.json +3 -1
- package/editions/free/src/localizations/no.json +3 -1
- package/editions/free/src/localizations/pl.json +3 -1
- package/editions/free/src/localizations/pt-br.json +3 -1
- package/editions/free/src/localizations/pt.json +3 -1
- package/editions/free/src/localizations/sv.json +3 -1
- package/editions/free/src/localizations/th.json +3 -1
- package/editions/free/src/localizations/tr.json +3 -1
- package/editions/free/src/localizations/uk.json +3 -1
- package/editions/free/src/localizations/zh-cn.json +3 -1
- package/editions/free/src/localizations/zh-tw.json +3 -1
- package/package.json +1 -1
- package/tests/GoToLink.test.js +48 -0
- package/tests/e2e/top-toolbar-tooltips.e2e.test.js +47 -0
- package/tests/tutorial/CogAndMartyTutorial.test.js +42 -0
- package/tutorial.ts +18 -130
|
@@ -599,7 +599,7 @@
|
|
|
599
599
|
"COG_AND_MARTY_TUTORIAL_MARTY_MODE": "Тепер перейдемо до Марті. Нам потрібно ввімкнути режим Марті, щоб побачити блоки Марті. Натисніть кнопку режиму Марті.",
|
|
600
600
|
"COG_AND_MARTY_TUTORIAL_ONMESSAGE_BLOCK": "У режимі Marty перетягніть блок «on message» із категорії Marty Start до області сценарію. Цей блок прослуховуватиме повідомлення, надіслане Cog.",
|
|
601
601
|
"COG_AND_MARTY_TUTORIAL_MARTY_MOTION_BLOCKS": "Тепер давайте виберемо блоки руху Марті. Клацніть категорію «Рух» блоків Марті.",
|
|
602
|
-
"COG_AND_MARTY_TUTORIAL_MARTY_DANCE_BLOCK": "Ми майже на місці! Перетягніть блок «Marty Dance»
|
|
602
|
+
"COG_AND_MARTY_TUTORIAL_MARTY_DANCE_BLOCK": "Ми майже на місці! Перетягніть блок «Marty Dance» під блок «on touch cog». Марті танцюватиме, коли буде натиснуто кнопку Cog.",
|
|
603
603
|
"COG_AND_MARTY_TUTORIAL_END": "Чудова робота! Ви успішно закодували Cog і Marty для взаємодії один з одним. Тепер натисніть кнопку Cog, щоб побачити танці Марті!",
|
|
604
604
|
"COG_JRBLOCKS1_TITLE": "1. Складіть мелодію",
|
|
605
605
|
"COG_JRBLOCKS1_STEP_1_TEXT": "Давайте змусимо Cog заграти мелодію!",
|
|
@@ -1149,6 +1149,7 @@
|
|
|
1149
1149
|
"MARTY_JRBLOCKS5_STEP_23_TEXT": "Завершіть це блоком <b/>лічильника запуску/зупинки</b>, щоб ваш рахунок скидався щоразу, коли ви починаєте нову гру.",
|
|
1150
1150
|
"MARTY_JRBLOCKS5_END": "Ви зробили це! Натисніть зелений прапорець і грайте в гру \"Гол-боут Марті\"!",
|
|
1151
1151
|
"A11Y_APP_NAVIGATION": "App navigation",
|
|
1152
|
+
"A11Y_CHANGE_SURFACE": "Change surface",
|
|
1152
1153
|
"A11Y_CLEAR_TRACE": "Clear trace",
|
|
1153
1154
|
"A11Y_CLOSE": "Close",
|
|
1154
1155
|
"A11Y_CONNECTION_LOST": "Connection lost",
|
|
@@ -1175,6 +1176,7 @@
|
|
|
1175
1176
|
"A11Y_RUN_PROJECT": "Run project",
|
|
1176
1177
|
"A11Y_SKIP_TO_MAIN": "Skip to main content",
|
|
1177
1178
|
"A11Y_STOP": "Stop",
|
|
1179
|
+
"A11Y_STOP_PROJECT": "Stop project",
|
|
1178
1180
|
"A11Y_TRACE": "Trace",
|
|
1179
1181
|
"A11Y_TUTORIAL_DIALOG": "Tutorial media",
|
|
1180
1182
|
"A11Y_ADD_PAGE": "Add page",
|
|
@@ -599,7 +599,7 @@
|
|
|
599
599
|
"COG_AND_MARTY_TUTORIAL_MARTY_MODE": "现在让我们转到 Marty。我们需要启用 Marty 模式才能查看 Marty 积木。点击 Marty 模式按钮。",
|
|
600
600
|
"COG_AND_MARTY_TUTORIAL_ONMESSAGE_BLOCK": "进入 Marty 模式后,将“on message”积木从 Marty Start 类别拖到脚本区域。该积木将监听 Cog 发送的消息。",
|
|
601
601
|
"COG_AND_MARTY_TUTORIAL_MARTY_MOTION_BLOCKS": "现在,让我们选择 Marty 的运动积木。点击 Marty 积木的“运动”类别。",
|
|
602
|
-
"COG_AND_MARTY_TUTORIAL_MARTY_DANCE_BLOCK": "快完成了!将“Marty Dance
|
|
602
|
+
"COG_AND_MARTY_TUTORIAL_MARTY_DANCE_BLOCK": "快完成了!将“Marty Dance”积木连接到“on touch cog”积木下方。按下 Cog 的按钮时,Marty 就会跳舞。",
|
|
603
603
|
"COG_AND_MARTY_TUTORIAL_END": "太棒了!你成功编写了 Cog 和 Marty 之间的交互代码。现在点击 Cog 的按钮,就能看到 Marty 跳舞啦!",
|
|
604
604
|
"COG_JRBLOCKS1_TITLE": "1. 创作一首曲子",
|
|
605
605
|
"COG_JRBLOCKS1_STEP_1_TEXT": "让我们让 Cog 演奏一段曲子吧!",
|
|
@@ -1149,6 +1149,7 @@
|
|
|
1149
1149
|
"MARTY_JRBLOCKS5_STEP_23_TEXT": "最后添加一个<b/>开始/停止计数器</b>模块,这样每次开始新游戏时,你的分数都会重置。",
|
|
1150
1150
|
"MARTY_JRBLOCKS5_END": "你成功了!按下绿旗,开始玩马蒂的射门游戏吧!",
|
|
1151
1151
|
"A11Y_APP_NAVIGATION": "App navigation",
|
|
1152
|
+
"A11Y_CHANGE_SURFACE": "Change surface",
|
|
1152
1153
|
"A11Y_CLEAR_TRACE": "Clear trace",
|
|
1153
1154
|
"A11Y_CLOSE": "Close",
|
|
1154
1155
|
"A11Y_CONNECTION_LOST": "Connection lost",
|
|
@@ -1175,6 +1176,7 @@
|
|
|
1175
1176
|
"A11Y_RUN_PROJECT": "Run project",
|
|
1176
1177
|
"A11Y_SKIP_TO_MAIN": "Skip to main content",
|
|
1177
1178
|
"A11Y_STOP": "Stop",
|
|
1179
|
+
"A11Y_STOP_PROJECT": "Stop project",
|
|
1178
1180
|
"A11Y_TRACE": "Trace",
|
|
1179
1181
|
"A11Y_TUTORIAL_DIALOG": "Tutorial media",
|
|
1180
1182
|
"A11Y_ADD_PAGE": "Add page",
|
|
@@ -599,7 +599,7 @@
|
|
|
599
599
|
"COG_AND_MARTY_TUTORIAL_MARTY_MODE": "現在讓我們轉到 Marty。我們需要啟用 Marty 模式才能查看 Marty 積木。點擊 Marty 模式按鈕。",
|
|
600
600
|
"COG_AND_MARTY_TUTORIAL_ONMESSAGE_BLOCK": "進入 Marty 模式後,將「on message」積木從 Marty Start 類別拖曳到腳本區域。該積木將監聽 Cog 發送的訊息。",
|
|
601
601
|
"COG_AND_MARTY_TUTORIAL_MARTY_MOTION_BLOCKS": "現在,讓我們選擇 Marty 的運動積木。點選 Marty 積木的「運動」類別。",
|
|
602
|
-
"COG_AND_MARTY_TUTORIAL_MARTY_DANCE_BLOCK": "
|
|
602
|
+
"COG_AND_MARTY_TUTORIAL_MARTY_DANCE_BLOCK": "快完成了!將「Marty Dance」積木連接到「on touch cog」積木下方。按下 Cog 的按鈕時,Marty 就會跳舞。",
|
|
603
603
|
"COG_AND_MARTY_TUTORIAL_END": "太棒了!你成功寫了 Cog 和 Marty 之間的互動程式碼。現在點擊 Cog 的按鈕,就能看到 Marty 跳舞啦!",
|
|
604
604
|
"COG_JRBLOCKS1_TITLE": "1. 創作一首曲子",
|
|
605
605
|
"COG_JRBLOCKS1_STEP_1_TEXT": "讓我們讓 Cog 演奏一段曲子吧!",
|
|
@@ -1149,6 +1149,7 @@
|
|
|
1149
1149
|
"MARTY_JRBLOCKS5_STEP_23_TEXT": "最後增加一個<b/>開始/停止計數器</b>模組,這樣每次開始新遊戲時,你的分數都會重置。",
|
|
1150
1150
|
"MARTY_JRBLOCKS5_END": "你成功了!按下綠旗,開始玩馬蒂的射門遊戲吧!",
|
|
1151
1151
|
"A11Y_APP_NAVIGATION": "App navigation",
|
|
1152
|
+
"A11Y_CHANGE_SURFACE": "Change surface",
|
|
1152
1153
|
"A11Y_CLEAR_TRACE": "Clear trace",
|
|
1153
1154
|
"A11Y_CLOSE": "Close",
|
|
1154
1155
|
"A11Y_CONNECTION_LOST": "Connection lost",
|
|
@@ -1175,6 +1176,7 @@
|
|
|
1175
1176
|
"A11Y_RUN_PROJECT": "Run project",
|
|
1176
1177
|
"A11Y_SKIP_TO_MAIN": "Skip to main content",
|
|
1177
1178
|
"A11Y_STOP": "Stop",
|
|
1179
|
+
"A11Y_STOP_PROJECT": "Stop project",
|
|
1178
1180
|
"A11Y_TRACE": "Trace",
|
|
1179
1181
|
"A11Y_TUTORIAL_DIALOG": "Tutorial media",
|
|
1180
1182
|
"A11Y_ADD_PAGE": "Add page",
|
package/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import goToLink from "../src/utils/goToLink";
|
|
3
|
+
|
|
4
|
+
describe("goToLink", () => {
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
vi.unstubAllGlobals();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("keeps query parameters when the server redirects HTML pages to clean URLs", async () => {
|
|
10
|
+
const targetWindow = { location: { href: "initial" } };
|
|
11
|
+
const fetchMock = vi.fn().mockResolvedValue({ redirected: true });
|
|
12
|
+
vi.stubGlobal("fetch", fetchMock);
|
|
13
|
+
|
|
14
|
+
await goToLink(
|
|
15
|
+
"http://localhost:3011/editor.html?pmd5=-1&mode=edit&tutorial=marty-jr-blocks-1",
|
|
16
|
+
targetWindow
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
expect(fetchMock).toHaveBeenCalledWith(
|
|
20
|
+
"http://localhost:3011/editor.html?pmd5=-1&mode=edit&tutorial=marty-jr-blocks-1"
|
|
21
|
+
);
|
|
22
|
+
expect(targetWindow.location.href).toBe(
|
|
23
|
+
"http://localhost:3011/editor?pmd5=-1&mode=edit&tutorial=marty-jr-blocks-1"
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("keeps HTML page URLs for wrapper servers that do not redirect", async () => {
|
|
28
|
+
const targetWindow = { location: { href: "initial" } };
|
|
29
|
+
vi.stubGlobal("fetch", vi.fn().mockResolvedValue({ redirected: false }));
|
|
30
|
+
|
|
31
|
+
await goToLink("./MartyBlocksJR/editor.html?tutorial=cog-jrblocks-1", targetWindow);
|
|
32
|
+
|
|
33
|
+
expect(targetWindow.location.href).toBe(
|
|
34
|
+
"./MartyBlocksJR/editor.html?tutorial=cog-jrblocks-1"
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("falls back to the HTML page URL when redirect detection is unavailable", async () => {
|
|
39
|
+
const targetWindow = { location: { href: "initial" } };
|
|
40
|
+
vi.stubGlobal("fetch", vi.fn().mockRejectedValue(new Error("fetch unavailable")));
|
|
41
|
+
|
|
42
|
+
await goToLink("editor.html?tutorial=cog-and-marty-tutorial", targetWindow);
|
|
43
|
+
|
|
44
|
+
expect(targetWindow.location.href).toBe(
|
|
45
|
+
"editor.html?tutorial=cog-and-marty-tutorial"
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -108,6 +108,53 @@ describe("top toolbar tooltips", () => {
|
|
|
108
108
|
|
|
109
109
|
expect(invalidTooltips).toEqual([]);
|
|
110
110
|
|
|
111
|
+
const initialActionLabels = await page.evaluate(() => ({
|
|
112
|
+
background: document.getElementById("setbkg").getAttribute("data-tooltip"),
|
|
113
|
+
run: document.getElementById("go").getAttribute("data-tooltip"),
|
|
114
|
+
}));
|
|
115
|
+
expect(initialActionLabels).toEqual({
|
|
116
|
+
background: "Change Background",
|
|
117
|
+
run: "Run project",
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const runningActionLabels = await page.evaluate(() => {
|
|
121
|
+
const runtime = window.ScratchJr.runtime;
|
|
122
|
+
const previousThreads = runtime.threadsRunning;
|
|
123
|
+
runtime.threadsRunning = [{
|
|
124
|
+
isRunning: true,
|
|
125
|
+
firstBlock: { blocktype: "onflag" },
|
|
126
|
+
}];
|
|
127
|
+
window.ScratchJr.updateRunStopButtons();
|
|
128
|
+
|
|
129
|
+
const go = document.getElementById("go");
|
|
130
|
+
const labels = {
|
|
131
|
+
ariaLabel: go.getAttribute("aria-label"),
|
|
132
|
+
tooltip: go.getAttribute("data-tooltip"),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
runtime.threadsRunning = previousThreads;
|
|
136
|
+
window.ScratchJr.updateRunStopButtons();
|
|
137
|
+
return labels;
|
|
138
|
+
});
|
|
139
|
+
expect(runningActionLabels).toEqual({
|
|
140
|
+
ariaLabel: "Stop project",
|
|
141
|
+
tooltip: "Stop project",
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
await page.click("#martyMode");
|
|
145
|
+
await page.waitForFunction(
|
|
146
|
+
() => document.getElementById("setbkg").getAttribute("data-tooltip") === "Change surface",
|
|
147
|
+
{ timeout: 5_000 }
|
|
148
|
+
);
|
|
149
|
+
const martyBackgroundLabels = await page.$eval("#setbkg", (button) => ({
|
|
150
|
+
ariaLabel: button.getAttribute("aria-label"),
|
|
151
|
+
tooltip: button.getAttribute("data-tooltip"),
|
|
152
|
+
}));
|
|
153
|
+
expect(martyBackgroundLabels).toEqual({
|
|
154
|
+
ariaLabel: "Change surface",
|
|
155
|
+
tooltip: "Change surface",
|
|
156
|
+
});
|
|
157
|
+
|
|
111
158
|
await page.hover("#grid");
|
|
112
159
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
113
160
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
vi.mock('@/utils/Localization', () => ({
|
|
4
|
+
default: {
|
|
5
|
+
localize: key => key
|
|
6
|
+
}
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe('Cog and Marty tutorial', () => {
|
|
10
|
+
it('builds one direct Cog-triggered Marty script in Marty mode', async () => {
|
|
11
|
+
const { default: tutorial } = await import('@/tutorial/tutorials-data/cog-and-marty.js');
|
|
12
|
+
const steps = tutorial.tutorialSteps;
|
|
13
|
+
const actions = steps.flatMap(step => [
|
|
14
|
+
...(step.instructionActions || []),
|
|
15
|
+
...(step.nextStepActions || []),
|
|
16
|
+
...(step.hintActions || [])
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
expect(steps).toHaveLength(8);
|
|
20
|
+
const cogCategoryStep = steps.find(step =>
|
|
21
|
+
step.instructionActions.some(action => action.text === 'COG_AND_MARTY_TUTORIAL_COG_BLOCKS'));
|
|
22
|
+
expect(cogCategoryStep.nextStepActions[0]).toEqual({ type: 'ShowMartyMode' });
|
|
23
|
+
expect(actions.filter(action => action.type === 'HighlightElement').map(action => action.elementId))
|
|
24
|
+
.not.toContain('martyMode');
|
|
25
|
+
|
|
26
|
+
expect(actions.filter(action => action.type === 'ShowCategory').map(action => action.category))
|
|
27
|
+
.not.toContain('sprite-start');
|
|
28
|
+
expect(actions.flatMap(action => action.blocks || (action.block ? [action.block] : [])))
|
|
29
|
+
.not.toEqual(expect.arrayContaining(['message_block', 'onmessage_block']));
|
|
30
|
+
expect(actions.filter(action => action.type === 'ShowInstructorText').map(action => action.text))
|
|
31
|
+
.not.toEqual(expect.arrayContaining([
|
|
32
|
+
'COG_AND_MARTY_TUTORIAL_SPRITE_BLOCKS',
|
|
33
|
+
'COG_AND_MARTY_TUTORIAL_MESSAGE_BLOCK',
|
|
34
|
+
'COG_AND_MARTY_TUTORIAL_ONMESSAGE_BLOCK'
|
|
35
|
+
]));
|
|
36
|
+
|
|
37
|
+
expect(steps.flatMap(step => step.expectedCode || [])).toEqual([
|
|
38
|
+
'ontouchcog',
|
|
39
|
+
'ontouchcog=>martyDance'
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
});
|
package/tutorial.ts
CHANGED
|
@@ -33,7 +33,7 @@ type TutorialStep = {
|
|
|
33
33
|
instructionActions: Action[];
|
|
34
34
|
hintActions?: Action[];
|
|
35
35
|
buttons: ("previous" | "next" | "hint")[];
|
|
36
|
-
expectedCode: string[]; // e.g: ["
|
|
36
|
+
expectedCode: string[]; // e.g: ["ontouchcog=>martyDance"] each element of the array corresponds to a script. each script is a series of blocks connected with =>
|
|
37
37
|
presenter: "marty"; // or any other sprite
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -112,7 +112,7 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
112
112
|
expectedCode: [],
|
|
113
113
|
presenter: "marty"
|
|
114
114
|
},
|
|
115
|
-
/* STEP 2 -- go to
|
|
115
|
+
/* STEP 2 -- enter Marty mode and go to Cog event blocks */
|
|
116
116
|
{
|
|
117
117
|
instructionActions: [
|
|
118
118
|
{
|
|
@@ -121,6 +121,9 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
121
121
|
}
|
|
122
122
|
],
|
|
123
123
|
nextStepActions: [
|
|
124
|
+
{
|
|
125
|
+
type: "ShowMartyMode",
|
|
126
|
+
},
|
|
124
127
|
{
|
|
125
128
|
type: "HighlightElement",
|
|
126
129
|
elementId: "cog-start",
|
|
@@ -130,10 +133,10 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
130
133
|
],
|
|
131
134
|
hintActions: [],
|
|
132
135
|
buttons: ["previous", "next"],
|
|
133
|
-
expectedCode: [
|
|
136
|
+
expectedCode: [],
|
|
134
137
|
presenter: "marty"
|
|
135
138
|
},
|
|
136
|
-
/* STEP 3 -- add ontouchcog block */
|
|
139
|
+
/* STEP 3 -- add ontouchcog block to Marty's script */
|
|
137
140
|
{
|
|
138
141
|
instructionActions: [
|
|
139
142
|
{
|
|
@@ -143,15 +146,8 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
143
146
|
],
|
|
144
147
|
nextStepActions: [
|
|
145
148
|
{
|
|
146
|
-
type: "
|
|
147
|
-
category: "cog-start"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
type: "HighlightBlocks",
|
|
151
|
-
blocks: ["ontouchcog_block"]
|
|
149
|
+
type: "ShowMartyMode",
|
|
152
150
|
},
|
|
153
|
-
],
|
|
154
|
-
hintActions: [
|
|
155
151
|
{
|
|
156
152
|
type: "ShowCategory",
|
|
157
153
|
category: "cog-start"
|
|
@@ -160,114 +156,6 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
160
156
|
type: "HighlightBlocks",
|
|
161
157
|
blocks: ["ontouchcog_block"]
|
|
162
158
|
},
|
|
163
|
-
{
|
|
164
|
-
type: "DragBlockToScriptArea",
|
|
165
|
-
block: "ontouchcog_block",
|
|
166
|
-
}
|
|
167
|
-
],
|
|
168
|
-
buttons: ["previous", "next", "hint"],
|
|
169
|
-
expectedCode: ["ontouchcog"],
|
|
170
|
-
presenter: "marty"
|
|
171
|
-
},
|
|
172
|
-
/* STEP 4 -- go to sprite event blocks */
|
|
173
|
-
{
|
|
174
|
-
instructionActions: [
|
|
175
|
-
{
|
|
176
|
-
type: "ShowInstructorText",
|
|
177
|
-
text: "Great! Now let's move to the Sprite blocks, which are on the left side of the screen."
|
|
178
|
-
}
|
|
179
|
-
],
|
|
180
|
-
nextStepActions: [
|
|
181
|
-
{
|
|
182
|
-
type: "HighlightElement",
|
|
183
|
-
elementId: "sprite-start",
|
|
184
|
-
hexColor: "#855cd659",
|
|
185
|
-
onClickAction: "NextStep"
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
hintActions: [],
|
|
189
|
-
buttons: ["previous", "next"],
|
|
190
|
-
expectedCode: [],
|
|
191
|
-
presenter: "marty"
|
|
192
|
-
},
|
|
193
|
-
/* STEP 5 -- add message block after the ontouchcog block */
|
|
194
|
-
{
|
|
195
|
-
instructionActions: [
|
|
196
|
-
{
|
|
197
|
-
type: "ShowInstructorText",
|
|
198
|
-
text: "Now drag the 'message' block from the Sprite Start category to the script area. This block will send a message to Marty when the sprite is clicked"
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
nextStepActions: [
|
|
202
|
-
{
|
|
203
|
-
type: "ShowCategory",
|
|
204
|
-
category: "sprite-start"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
type: "HighlightBlocks",
|
|
208
|
-
blocks: ["message_block"]
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
hintActions: [
|
|
212
|
-
{
|
|
213
|
-
type: "ShowCategory",
|
|
214
|
-
category: "sprite-start"
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: "HighlightBlocks",
|
|
218
|
-
blocks: ["message_block"]
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
type: "DragBlockToScriptArea",
|
|
222
|
-
block: "message_block",
|
|
223
|
-
}
|
|
224
|
-
],
|
|
225
|
-
buttons: ["previous", "next", "hint"],
|
|
226
|
-
expectedCode: ["ontouchcog=>message"],
|
|
227
|
-
presenter: "marty"
|
|
228
|
-
},
|
|
229
|
-
/* STEP 6 -- go to marty mode */
|
|
230
|
-
{
|
|
231
|
-
instructionActions: [
|
|
232
|
-
{
|
|
233
|
-
type: "ShowInstructorText",
|
|
234
|
-
text: "Now let's move to Marty. We need to enable Marty Mode to see the Marty blocks. Click on the Marty Mode button."
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
nextStepActions: [
|
|
238
|
-
{
|
|
239
|
-
type: "HighlightElement",
|
|
240
|
-
elementId: "martyMode",
|
|
241
|
-
hexColor: "#855cd659",
|
|
242
|
-
onClickAction: "NextStep"
|
|
243
|
-
}
|
|
244
|
-
],
|
|
245
|
-
hintActions: [
|
|
246
|
-
],
|
|
247
|
-
buttons: ["previous", "next"],
|
|
248
|
-
expectedCode: [],
|
|
249
|
-
presenter: "marty"
|
|
250
|
-
},
|
|
251
|
-
/* STEP 7 -- add onmessage block */
|
|
252
|
-
{
|
|
253
|
-
instructionActions: [
|
|
254
|
-
{
|
|
255
|
-
type: "ShowInstructorText",
|
|
256
|
-
text: "Once in Marty Mode, drag the 'on message' block from the Marty Start category to the script area. This block will listen for the message sent by Cog"
|
|
257
|
-
}
|
|
258
|
-
],
|
|
259
|
-
nextStepActions: [
|
|
260
|
-
{
|
|
261
|
-
type: "ShowMartyMode",
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
type: "ShowCategory",
|
|
265
|
-
category: "marty-start"
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
type: "HighlightBlocks",
|
|
269
|
-
blocks: ["onmessage_block"]
|
|
270
|
-
}
|
|
271
159
|
],
|
|
272
160
|
hintActions: [
|
|
273
161
|
{
|
|
@@ -275,22 +163,22 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
275
163
|
},
|
|
276
164
|
{
|
|
277
165
|
type: "ShowCategory",
|
|
278
|
-
category: "
|
|
166
|
+
category: "cog-start"
|
|
279
167
|
},
|
|
280
168
|
{
|
|
281
169
|
type: "HighlightBlocks",
|
|
282
|
-
blocks: ["
|
|
170
|
+
blocks: ["ontouchcog_block"]
|
|
283
171
|
},
|
|
284
172
|
{
|
|
285
173
|
type: "DragBlockToScriptArea",
|
|
286
|
-
block: "
|
|
174
|
+
block: "ontouchcog_block",
|
|
287
175
|
}
|
|
288
176
|
],
|
|
289
177
|
buttons: ["previous", "next", "hint"],
|
|
290
|
-
expectedCode: ["
|
|
178
|
+
expectedCode: ["ontouchcog"],
|
|
291
179
|
presenter: "marty"
|
|
292
180
|
},
|
|
293
|
-
/* STEP
|
|
181
|
+
/* STEP 4 -- go to marty motion blocks */
|
|
294
182
|
{
|
|
295
183
|
instructionActions: [
|
|
296
184
|
{
|
|
@@ -316,12 +204,12 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
316
204
|
expectedCode: [],
|
|
317
205
|
presenter: "marty"
|
|
318
206
|
},
|
|
319
|
-
/* STEP
|
|
207
|
+
/* STEP 5 -- add marty dance block after the Cog trigger */
|
|
320
208
|
{
|
|
321
209
|
instructionActions: [
|
|
322
210
|
{
|
|
323
211
|
type: "ShowInstructorText",
|
|
324
|
-
text: "We're almost there! Drag the '
|
|
212
|
+
text: "We're almost there! Drag the 'Marty Dance' block beneath the 'on touch cog' block. Marty will dance when Cog's button is pressed."
|
|
325
213
|
}
|
|
326
214
|
],
|
|
327
215
|
nextStepActions: [
|
|
@@ -355,15 +243,15 @@ const cogAndMartyTutorial: Tutorial = {
|
|
|
355
243
|
}
|
|
356
244
|
],
|
|
357
245
|
buttons: ["previous", "next", "hint"],
|
|
358
|
-
expectedCode: ["
|
|
246
|
+
expectedCode: ["ontouchcog=>martyDance"],
|
|
359
247
|
presenter: "marty"
|
|
360
248
|
},
|
|
361
|
-
/* STEP
|
|
249
|
+
/* STEP 6 -- end */
|
|
362
250
|
{
|
|
363
251
|
instructionActions: [
|
|
364
252
|
{
|
|
365
253
|
type: "ShowInstructorText",
|
|
366
|
-
text: "Great job! You have successfully coded Cog and Marty to interact with each other.
|
|
254
|
+
text: "Great job! You have successfully coded Cog and Marty to interact with each other. Now click Cog's button to see Marty dance!"
|
|
367
255
|
}
|
|
368
256
|
],
|
|
369
257
|
nextStepActions: [],
|