Skip to content

Commit a578c77

Browse files
Add speed parameter
1 parent 1cc3589 commit a578c77

File tree

8 files changed

+43
-8
lines changed

8 files changed

+43
-8
lines changed

.github/makecode/blocks.png

17.1 KB
Loading

.github/makecode/blocksdiff.png

16.1 KB
Loading

achievements.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ namespace Achievements {
99
* @param displayDescription: The discription of the achievement that is shown to the player - optional.
1010
* @param icon: The icon of the achievement when shown to the player, must be 8x8 otherwise ignored.
1111
*/
12-
//% block="show achievement with title as $displayName||and description as $displayDescription|and icon as $icon"
12+
//% block="show achievement with title as $displayName||and description as $displayDescription|at speed $speed|and icon as $icon"
1313
//% icon.shadow=screen_image_picker
14+
//% speed.defl=1
1415
//% expandableArgumentMode="enabled"
1516
//% weight=90
16-
export function showAchievement(displayName: string, displayDescription?: string, icon?: Image) {
17+
export function showAchievement(displayName: string, displayDescription?: string, speed?: number, icon?: Image) {
1718
if (!(displayDescription)) {
1819
displayDescription = ""
1920
}
2021
Notification.waitForNotificationFinish()
2122
if (displayDescription == "") {
22-
Notification.notify("Achievement get: " + displayName + "!", icon)
23+
Notification.notify("Achievement get: " + displayName + "!", speed, icon)
2324
} else {
24-
Notification.notify("Achievement get! " + displayName + ": " + displayDescription, icon)
25+
Notification.notify("Achievement get! " + displayName + ": " + displayDescription, speed, icon)
2526
}
2627
}
2728
/**

images.g.jres

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"image1": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
23
"*": {
34
"mimeType": "image/x-mkcd-f4",
45
"dataEncoding": "base64",

images.g.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@ namespace myImages {
33

44
helpers._registerFactory("image", function(name: string) {
55
switch(helpers.stringTrim(name)) {
6-
6+
case "image1":return img`
7+
. . . . . . . . . . . . . . . .
8+
. . . . . . . . . . . . . . . .
9+
. . . . . . . . . . . . . . . .
10+
. . . . . . . . . . . . . . . .
11+
. . . . . . . . . . . . . . . .
12+
. . . . . . . . . . . . . . . .
13+
. . . . . . . . . . . . . . . .
14+
. . . . . . . . . . . . . . . .
15+
. . . . . . . . . . . . . . . .
16+
. . . . . . . . . . . . . . . .
17+
. . . . . . . . . . . . . . . .
18+
. . . . . . . . . . . . . . . .
19+
. . . . . . . . . . . . . . . .
20+
. . . . . . . . . . . . . . . .
21+
. . . . . . . . . . . . . . . .
22+
. . . . . . . . . . . . . . . .
23+
`;
724
}
825
return null;
926
})

main.blocks

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="@CV3U1dWxXHt^VQjt{g1">enemies_killed</variable></variables></xml>
1+
<xml xmlns="https://developers.google.com/blockly/xml"><block type="pxt-on-start" id="(oJxsr8iD!ctI))5Nc!V" x="0" y="0"><statement name="HANDLER"><block type="Achievements_showAchievement" id="@Yg,uy(J+u]Rn{KVd6g)"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="2" _input_init="true"></mutation><value name="displayName"><shadow type="text" id="@Xp?@%2paxsr0Sk#3GgO"><field name="TEXT">asdf</field></shadow></value><value name="displayDescription"><shadow type="text" id=",+ow%0(3KPkFjR16x/5O"><field name="TEXT">asdf!</field></shadow></value><value name="speed"><shadow type="math_number" id="Qf+qZyN;Ju#GQ@QVyPM9"><field name="NUM">0.5</field></shadow></value><value name="icon"><shadow type="screen_image_picker" id="lMw79^+1S[+yV9p=O__*"><field name="img">img`
2+
. . . . . . . . . . . . . . . .
3+
. . . . . . . . . . . . . . . .
4+
. . . . . . . . . . . . . . . .
5+
. . . . . . . . . . . . . . . .
6+
. . . . . . . . . . . . . . . .
7+
. . . . . . . . . . . . . . . .
8+
. . . . . . . . . . . . . . . .
9+
. . . . . . . . . . . . . . . .
10+
. . . . . . . . . . . . . . . .
11+
. . . . . . . . . . . . . . . .
12+
. . . . . . . . . . . . . . . .
13+
. . . . . . . . . . . . . . . .
14+
. . . . . . . . . . . . . . . .
15+
. . . . . . . . . . . . . . . .
16+
. . . . . . . . . . . . . . . .
17+
. . . . . . . . . . . . . . . .
18+
`</field><data>{"commentRefs":[],"fieldData":{"img":null}}</data></shadow></value></block></statement></block></xml>

main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

pxt.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "",
44
"dependencies": {
55
"device": "*",
6-
"Notifications": "github:unsignedarduino/notifications#2a1dfa1a8c4ecf02cfb8b53521f82371a222e3e5",
6+
"Notifications": "github:unsignedarduino/notifications#aaf5aa6936ed796370ca1d224fabada798997269",
77
"settings-blocks": "github:microsoft/pxt-settings-blocks#v1.0.0"
88
},
99
"files": [

0 commit comments

Comments
 (0)