Why do i get this error when converting to blocks

I am making a game that i push to github. I found something similar from Feb 6. 2020.

But my code doesen’t use:

img’…

i use:

assets.image’…’

So i don’t get why i get this error. I could just code in TS but i am not that good at it and prefer blocks.

Game and github repo

If you fix it you can push to github and i’ll look into it :slightly_smiling_face:

1 Like

Hello, I appear to be getting this error in my new project as well. I have systematically removed every bit of code one at a time to try and locate the issue. I also removed ALL of the code, same issue, I just cannot go back to blocks. Seems like a bug for sure. I can include anything you need, just let me know.

1 Like

As a follow-up, here is my (JS) code that won’t convert to blocks:

enum ActionKind {
    Walking,
    Idle,
    Jumping
}
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
    animation.runImageAnimation(
        mySprite,
        assets.animation`animWalkLeft`,
        250,
        true
    )
})
controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
    animation.runImageAnimation(
        mySprite,
        assets.animation`animWalkRight`,
        250,
        true
    )
})
let enemy: Sprite = null
function spawnEnemy() {
    enemy = sprites.create(assets.image`spriteGhrasto`, SpriteKind.Enemy)
    tiles.placeOnTile(enemy, tiles.getTileLocation(2, 7))
    enemy.follow(mySprite, 20)
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
    sprites.destroy(otherSprite, effects.spray, 500)
    info.changeScoreBy(1)
    scene.cameraShake(4, 500)
    music.play(music.randomizeSound(music.createSoundEffect(WaveShape.Noise, 5000, 1877, 255, 0, 500, SoundExpressionEffect.Warble, InterpolationCurve.Logarithmic)), music.PlaybackMode.UntilDone)
})
let mySprite: Sprite = null
scene.setBackgroundColor(15)
game.setDialogTextColor(2)
game.splash("Title")
game.setDialogTextColor(9)
game.splash("Dev Name")
scene.setBackgroundColor(9)
scene.createRenderable(scene.HUD_Z, function (target, camera) {
    const w = 40
    const h = 15
    const x = 2
    const y = 2

    // Draw outline
    screen.drawRect(
        x,
        y,
        w,
        h,
        /** black **/ 0x0
    )
    // Fill inside rect
    screen.fillRect(
        x + 1,
        y + 1,
        w - 2,
        h - 2,
        /** black **/ 0x0
    )
    // Fill it in with whatever else you want
    // text
    let t = info.score()
    screen.print(
        "  " + t.toString(),
        x + 2,
        y + 4,
        /** white **/ 0x1,
        image.font8
    )
    // or an image
    screen.drawTransparentImage(
        img`
            . . b . b . b
            . b b b b b .
            b . . b . . b
            b . . b . . b
            b b b b b b b
            . b . b . b .
            . . . . . . .
            . . b b b . .
        `,
        // if you want to space text horizontally,
        // note the t.length * image.font8.charWidth to
        // get the width of the text below
        x + 2,
        y + 4
    )
})
tiles.setCurrentTilemap(tilemap`roomBathDoomArena`)
mySprite = sprites.create(assets.image`Ducky`, SpriteKind.Player)
tiles.placeOnTile(mySprite, tiles.getTileLocation(4, 3))
animation.runImageAnimation(
    mySprite,
    assets.animation`animWalkRight`,
    500,
    true
)
game.onUpdate(function () {
    scene.cameraFollowSprite(mySprite)
    controller.moveSprite(mySprite, 50, 50)
})
game.onUpdateInterval(5000, function () {
    spawnEnemy()
})
1 Like

Update: looks like it may have been a glitch in my actual project; I copy/pasted the code into a new project and was able to switch to block view. I’m going to copy all of my assets across to the new project and hopefully i’ll be g2g.

2 Likes

These kinds of issues are usually to do with an error in one of the system files, like pxt.json or such

1 Like