transition help

I am currently working on level transitions in a game. We tried using director, but most of the code was already there and it proved to difficult to implement at this point. We have it to go Main menu --> mini map --> level one. each on a button click. The main menu to mini map works but the button on the mini map isn’t responding. here is the transition code we have. [code] function world1MiniLoad()
print((_W/500), _H/1000)
Levelbackground = display.newImage( “world1Mini.png”, true)
Levelbackground.x = 0*_W/500+_W/2
Levelbackground.y = 0*_H/1000+_H/2
Levelbackground:scale(display.contentWidth/500, display.contentHeight/1000)
Levelbackground: setReferencePoint(display.TopLeftReferencePoint)
Levelbackground:toBack()
continueB = display.newImage(‘continue.png’)
continueB:addEventListener(“tap”, worldOne)
continueB:addEventListener(“tap”, tweenMS)
continueB.x = 250
continueB.y = 530
end

function worldOne:tap(e)

if(e.target.name == “continueB”) then

– start game
–startB = display.newImage(‘newGame2.png’)
–audio.stop(menuSoundtrack)
–menuSoundtrack = nil

–audio.play(newSound)
–transition.to (menuScreen,{time =500, y= -menuScreen.height, transition = easing.outExpo, onComplete = worldOne})

– startB.isVisible = false
– continueB.isVisible = false
– addWorldB.isVisible = false
– optonB.isVisible = false

WorldOneLevels:levelZeroLoad()
–audio.stop(menuSoundtrack)
–audio.play(world1Soundtrack)
–Richload()
–menuScreen:removeSelf()
–menuScreen = nil
end
end [import]uid: 94237 topic_id: 17771 reply_id: 317771[/import]

It’s hard to tell anything with that little snippet.
But try to move the continueB:addEventListener(“tap”, worldOne) below the function!
That might work [import]uid: 13097 topic_id: 17771 reply_id: 67797[/import]

i could provide the code from the main.lua if you think that will help? [import]uid: 94237 topic_id: 17771 reply_id: 67798[/import]

when I tried that it didn’t recognize continueB. Here’s some of the code from main. [code] local physics = require ‘physics’
physics.start()
physics.setGravity(0, 0)
–require world1Mini
local background
local menuScreen
local mScreen
local newB
local continueB
local addWorldB
local optionB
–WorldOneLevels = require (“world1Mini”) – this is what was missing, right now it didn’t know what worldOneLevels was. This is it.
worldOneLevels = require (“WorldOneLevels”)
–Richload = require (“Rich”)
local menuSoundtrack = audio.loadStream (‘AClimber_Title.mp3’)
local world1Soundtrack = audio.loadStream(‘AClimber_World_1.mp3’)
local newSound = audio.loadSound(‘silencer.wav’)

local addMenuScreen = {}
local worldOne = {}
local tweenMS = {}
local startGame = {}

local function Main()
addMenuScreen()
end

function addMenuScreen()
menuScreen = display.newGroup()
mScreen = display.newImage(‘titleNoButtons.png’, true)
newB = display.newImage(‘newGame.png’)
newB.name = ‘startB’
continueB = display.newImage(‘continue.png’)
continueB.name = ‘continueB’
addWorldB = display.newImage(‘addWorld.png’)
addWorldB.name = ‘addWorldB’
optionB = display.newImage(‘option.png’)
optionB.name = ‘optionB’
menuScreen:insert(mScreen)
–audio.play(menuSoundtrack,{loops = -1})
menuScreen:scale(display.contentWidth/640, display.contentHeight/960)
newB.x = 250
newB.y = 400
menuScreen:insert(newB)
continueB.x = 250
continueB.y = 530
menuScreen:insert(continueB)
addWorldB.x = 250
addWorldB.y = 660
menuScreen:insert(addWorldB)
optionB.x = 250
optionB.y = 790
menuScreen:insert(optionB)

function tweenMS:tap(e)
audio.play(newSound)
end

– Button Listeners

newB:addEventListener(‘tap’, worldOne)
newB:addEventListener(‘tap’, tweenMS)
continueB:addEventListener(‘tap’, tweenMS)
addWorldB:addEventListener(‘tap’,tweenMS)
optionB:addEventListener(‘tap’,tweenMS)
end

function worldOne:tap(e)

if(e.target.name == “startB”) then

– start game
–startB = display.newImage(‘newGame2.png’)
audio.stop(menuSoundtrack)
menuSoundtrack = nil

audio.play(newSound)
–transition.to (menuScreen,{time =500, y= -menuScreen.height, transition = easing.outExpo, onComplete = worldOne})

– startB.isVisible = false
– continueB.isVisible = false
– addWorldB.isVisible = false
– optonB.isVisible = false

WorldOneLevels:world1MiniLoad()
–audio.stop(menuSoundtrack)
audio.play(world1Soundtrack)
–Richload()
menuScreen:removeSelf()
menuScreen = nil
end
end [import]uid: 94237 topic_id: 17771 reply_id: 67799[/import]

I would encourage you to upload a sample if you can’t provide plug and play code; makes it much easier on the people trying to help you if they can test your code themselves :wink:

Peach [import]uid: 52491 topic_id: 17771 reply_id: 67878[/import]

how do I upload a sample?

[import]uid: 94237 topic_id: 17771 reply_id: 68037[/import]

Upload a zip folder to a file sharing website (or your own server) then provide a link.

Peach :slight_smile: [import]uid: 52491 topic_id: 17771 reply_id: 68078[/import]