Microsoft MakeCode

Arcade and Documentation - template starting blocks showing errors

Hi there,
I’m working on Arcade docs to support a Family Game making programme I’m running.

I may be stretching the limits of the system, but I’m looking to start my docs from a relatively full project that works, and then for users to tweak aspects of the project. A learning my remixing approach.

I’m getting errors when trying to make the following project code available as a starting template, using the template macro.

Here is my result with errors showing in the starting code.

Can anyone see the problem here? Thanks in advance for your help.
Many

You are using the old tilemap APIs so you need to add the color-coded-tilemap package. Add this at the bottom of the file:

```package
color-coded-tilemap
```

If you want to add other packages, you can add them on new lines like this:

```package
color-coded-tilemap
animation
```

ok
super helpful.
i’m on this.
it does make me think if this is a bit deprecated, should I rethink.

Thanks
Mick

Hi there,
I’m tacking on to here as it seems related.Let me know if I should repost.

My from scratch tutorial is progressing well - the process is flowing but some tricky bits about getting blocks to display in tooltips correctly, which I understand from seeing a MakeCode tutorial demo at Microbit Live is the preferred way of doing things.

Here’s the latest.

Blocks in the latest step 14 - the blocks aren’t showing.
I haven’t added any packages but can’t quite get a combination that shows my desired loop.

Here’s a project with the blocks needed https://arcade.makecode.com/31308-11867-77961-95200

Here’s what I’m trying

```blocks
for (let value of tiles.getTilesByType(myTiles.tile1)) {
    strawberry = sprites.create(img`
        . . . . . . . 6 . . . . . . . .
        . . . . . . 8 6 6 . . . 6 8 . .
        . . . e e e 8 8 6 6 . 6 7 8 . .
        . . e 2 2 2 2 e 8 6 6 7 6 . . .
        . e 2 2 4 4 2 7 7 7 7 7 8 6 . .
        . e 2 4 4 2 6 7 7 7 6 7 6 8 8 .
        e 2 4 5 2 2 6 7 7 6 2 7 7 6 . .
        e 2 4 4 2 2 6 7 6 2 2 6 7 7 6 .
        e 2 4 2 2 2 6 6 2 2 2 e 7 7 6 .
        e 2 4 2 2 4 2 2 2 4 2 2 e 7 6 .
        e 2 4 2 2 2 2 2 2 2 2 2 e c 6 .
        e 2 2 2 2 2 2 2 4 e 2 e e c . .
        e e 2 e 2 2 4 2 2 e e e c . . .
        e e e e 2 e 2 2 e e e c . . . .
        e e e 2 e e c e c c c . . . . .
        . c c c c c c c . . . . . . . .
    `, SpriteKind.Food)
    tiles.placeOnTile(strawberry, value)
    tiles.setTileAt(value, myTiles.tile0)
}
```

Here’s what I’d like to show.
Screenshot_2020-02-17 Microsoft MakeCode Arcade

On a related note

How would you display only one block so that it excludes the wrapping on start function? Or is using an image preferred in this case?

For example

```blocks
scene.setBackgroundColor(9)
```

The ```block macro (no s) shows just just the blocks you put in it (no on start) in the docs view, but I can’t say I’ve ever it in a tutorial - it currently might not filter the tutorial or render incorrectly, the feature hasn’t been used much lately.

It looks like block doesn’t render unfortunately.

image

I’ll use an image or just try to describe little ones like this well in text and colour coded macros.

Any ideas on the other scenario?

This is something we should fix.

block is supported in docs but not in app yet

Oh, I missed the other question, sorry! Looks like it’s missing the tiles namespace, which stores information about the tilemap – in particular, the custom tiles you drew.

in this case, it looks like we should be able to trim the set tile and still have the block show up exactly as you wanted:

```blocks
namespace myTiles {
    //% blockIdentity=images._tile
    export const tile0 = img`
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
    `
    //% blockIdentity=images._tile
    export const tile1 = img`
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
        5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
    `
}
let strawberry: Sprite = null
for (let value of tiles.getTilesByType(myTiles.tile1)) {
    strawberry = sprites.create(img`
        . . . . . . . 6 . . . . . . . .
        . . . . . . 8 6 6 . . . 6 8 . .
        . . . e e e 8 8 6 6 . 6 7 8 . .
        . . e 2 2 2 2 e 8 6 6 7 6 . . .
        . e 2 2 4 4 2 7 7 7 7 7 8 6 . .
        . e 2 4 4 2 6 7 7 7 6 7 6 8 8 .
        e 2 4 5 2 2 6 7 7 6 2 7 7 6 . .
        e 2 4 4 2 2 6 7 6 2 2 6 7 7 6 .
        e 2 4 2 2 2 6 6 2 2 2 e 7 7 6 .
        e 2 4 2 2 4 2 2 2 4 2 2 e 7 6 .
        e 2 4 2 2 2 2 2 2 2 2 2 e c 6 .
        e 2 2 2 2 2 2 2 4 e 2 e e c . .
        e e 2 e 2 2 4 2 2 e e e c . . .
        e e e e 2 e 2 2 e e e c . . . .
        e e e 2 e e c e c c c . . . . .
        . c c c c c c c . . . . . . . .
    `, SpriteKind.Food)
    tiles.placeOnTile(strawberry, value)
    tiles.setTileAt(value, myTiles.tile0)
}
```

looks like

and as mentioned above, once the fix is released for ```block, could look like this if you wanted

Many thanks for these replies.
That makes sense now and I should be able to put this into action.

The platformer tutorial is really coming along now (still a few things to tweak).

I’ve got a part one here. https://arcade.makecode.com/#tutorial:37423-53392-83832-08292

and part two here

These are still not ready for review yet. But let me know the best way to share them for community review. Would it be as links like the above or as a github repo? and if the second what kind of format - just the md and image files?

Thanks
Mick

Best to use GitHub so that you can update your tutorial. You can do https://arcade.makecode.com/beta#tutorial:GITHUN_URL to send people into it.

“block” fix coming up

Hi there,
I’ve struggled a bit more than I thought I would with this, would it be possible for someone to check that these load ok before I repost for community feedback - thanks. :slight_smile:

Part One - Simple Platformer Tutorial (with new tilemap)

Part Two - Simple Platformer Tutorial (with new tilemap)

Thanks for the help so far.

I’ve still been struggling but managed to get the links above working for review.

I’ve started a new thread requesting review and bringing up a couple more questions on docs here
https://forum.makecode.com/t/review-requested-on-a-platformer-tutorial-and-start-of-set-of-course-resourse/1355