Adding backdrop with mte.addSptrie and storyboard scene

Hi Again

I use mte with storyboard scene.

I wanted to load backdrop like in MTE examples so I use:

    local backdrop = display.newImageRect( “Image”,768,768)

    local setup = {layer = 1,   locX = 2, locY = 1, 

        levelWidth = 768, levelHeight = 768, offsetX = 0, offsetY = 0

    }

    mte.addSprite(backdrop,setup)

all it does is to show image on main group (in front of all layers and images) and not to the layer 1.

is it because of storyboard scene or something?

btw: when I add kind = “imageRect” to setup all I have is an RuntimeError 

at Line: 1780

Attempt to perform arithmetic on upvalue ‘scaleFactorX’ (a nil value)

I use latest MTE beta version 0957b

any ideas?

Hello FatPixel,

From what you’ve posted it looks like you’re calling mte.addSprite(backdrop, setup) before you call mte.goto() or mte.setCamera(). You must call one of those two functions before you call mte.addSprite, or the variables it needs, such as scaleFactorX, will be nil. 

Once you straighten that out, you will need to put kind = “imageRect” back into the setup table. The image won’t be added to the map unless kind is set, instead it will just overlay the map as you described.

yup!

that works well.

thanks!

Hello FatPixel,

From what you’ve posted it looks like you’re calling mte.addSprite(backdrop, setup) before you call mte.goto() or mte.setCamera(). You must call one of those two functions before you call mte.addSprite, or the variables it needs, such as scaleFactorX, will be nil. 

Once you straighten that out, you will need to put kind = “imageRect” back into the setup table. The image won’t be added to the map unless kind is set, instead it will just overlay the map as you described.

yup!

that works well.

thanks!