long menu levels, how do they do it.

Hello…

Have you seen those games, like the new “The Book Of Life” game

similar to Candy Crash.

Where it has the “Choose Level Menu Page”

You see an image on the iPad, and a few levels in a snake form.

you scroll down, and see more levels,

and more, and more… and more, and more…

The image is “Really long” I would say 2 150 437 pixels long

maybe longer…

If I have an image like that big, that size, even optimized,

I would use 30 MB just in one image. Way to big…

So how do they do that?

Also notice that they have 347 buttons levels

each button moves along with the background image

in sync. Really nice, but how do they do that.

Thanks for your help.

They slice up the backrounds and lay in the images as they go.  The ‘menu’ is not all pre-loaded.

This is the same concept applied to discrete images:

http://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2014/10

Read main.lua carefully if you’re going to run this example:

http://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2014/10/Texture%20Memory%20Management/main.lua

You have to init the sample, modify main, then re-run it to see it in action.  

1000 samples is the default setting and ONLY for running on a PC or Mac.  Make it 100 samples for a device.

Thank you very much.

You gave me a great idea. I just have to adjust a few things.

could you please tell me a little bit more about the famous “self”

moveUp = function( self )     transition.to( self, { y = -maxY, time = moveTime, onComplete = moveDown } ) end moveDown = function( self )     transition.to( self, { y = 0, time = moveTime, onComplete = moveUp } ) end moveUp( pictureTray )

I see this in your code, but I don’t see any variable named “self”

thnaks

That code isn’t part of the solution to the problem.  It merely scrolls up and down infinitely, so you don’t need to understand it…that said:

-- self is the name of the first argument in the function below not a variable somewhere else -- moveUp = function( self ) transition.to( self, { y = -maxY, time = moveTime, onComplete = moveDown } ) end -- I could have called it anything -- moveDown = function( booya ) transition.to( booya, { y = 0, time = moveTime, onComplete = moveUp } ) end -- When you call this: moveUp( pictureTray ) -- pictureTray is passed in as the first argument 'self' to moveUp() -- Then moveUp runs the transition... -- when that transition completes, it calls the function pointed to by onComplete and -- passes in the current object the transition is operating on, thus calling -- moveDown() and passing in the reference to 'pictureTray' as the named argument 'booya'. -- This cycle continues forever.

People like to use the name ‘self’ because it is consistent with colon notation:

---------------------------------------------- -- This: -- local player = {} player.name = "Bob" function player.doit( self ) print("My name is: ", self.name ) end player.doit( player ) -- OR player:doit() ---------------------------------------------- -- Is the same as: -- local player = {} player.name = "Bob" function player:doit() -- A variable is implied and it will be called 'self'. print("My name is: ", self.name ) end player.doit( player ) -- OR player:doit()

They slice up the backrounds and lay in the images as they go.  The ‘menu’ is not all pre-loaded.

This is the same concept applied to discrete images:

http://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2014/10

Read main.lua carefully if you’re going to run this example:

http://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2014/10/Texture%20Memory%20Management/main.lua

You have to init the sample, modify main, then re-run it to see it in action.  

1000 samples is the default setting and ONLY for running on a PC or Mac.  Make it 100 samples for a device.

Thank you very much.

You gave me a great idea. I just have to adjust a few things.

could you please tell me a little bit more about the famous “self”

moveUp = function( self )     transition.to( self, { y = -maxY, time = moveTime, onComplete = moveDown } ) end moveDown = function( self )     transition.to( self, { y = 0, time = moveTime, onComplete = moveUp } ) end moveUp( pictureTray )

I see this in your code, but I don’t see any variable named “self”

thnaks

That code isn’t part of the solution to the problem.  It merely scrolls up and down infinitely, so you don’t need to understand it…that said:

-- self is the name of the first argument in the function below not a variable somewhere else -- moveUp = function( self ) transition.to( self, { y = -maxY, time = moveTime, onComplete = moveDown } ) end -- I could have called it anything -- moveDown = function( booya ) transition.to( booya, { y = 0, time = moveTime, onComplete = moveUp } ) end -- When you call this: moveUp( pictureTray ) -- pictureTray is passed in as the first argument 'self' to moveUp() -- Then moveUp runs the transition... -- when that transition completes, it calls the function pointed to by onComplete and -- passes in the current object the transition is operating on, thus calling -- moveDown() and passing in the reference to 'pictureTray' as the named argument 'booya'. -- This cycle continues forever.

People like to use the name ‘self’ because it is consistent with colon notation:

---------------------------------------------- -- This: -- local player = {} player.name = "Bob" function player.doit( self ) print("My name is: ", self.name ) end player.doit( player ) -- OR player:doit() ---------------------------------------------- -- Is the same as: -- local player = {} player.name = "Bob" function player:doit() -- A variable is implied and it will be called 'self'. print("My name is: ", self.name ) end player.doit( player ) -- OR player:doit()