How to change scenes

[lua]

local storyboard = require “storyboard”

storyboard.gotoScene( “game”, options )

[/lua]

Above is the most basic of scene changes. You would probably want to wrap that goToScene call in a listener attached to something like a button, I suspect. Go and have a look at the storyboard tutorial and try to write a bit of code and do some trial and error.

If you don’t put in any effort and try to do it yourself, nobody else will. If you end up getting stuck, post the code your having problems with and people will probably be more inclined to help. A general “tell me how to do everything so I don’t have to” isn’t going to get many responses.

Especially since your in the wrong subforum for storyboard :slight_smile:

Thank you Mourdos: For the time you took to post this…

I AM VERY VERY VERY NEW AT ALL THIS! So

– local storyboard = require “storyboard”

– storyboard.gotoScene (“game”, options)

it doesn’t tell me anything, I just don’t get it, and I don’t know how to use it or put it in my code.

I just one to change the page, like a book.

YOU: “You would probably want to wrap that goToScene call in a listener attached to something like a button, I suspect”

ME: If you mean “goToScene” go to another “Page” yes that it’s what I want, BUT I DON’T KNOW HOW.

       When you said “attached to a button”, Yes!, but I don’t know how.

YOU: “Go and have a look at the storyboard tutorial and try to write a bit of code and do some trial and error.”

ME: I don’t know where it is…And even If I find it, I go and just read and click, isn’t it another way? I would not know what

        I’m looking for, so I don’t know what to click.

YOU: “If you don’t put in any effort”

ME: Yes I AM putting a lot of effeort, I bought a book from Dr. Burton, I still don’t find that answer ( and I read all the book

        already). I download about 20 sample code from github, and nothing, I watch about 100 videos on youtube, and nothing

        all I have is this forum it’s the only one I have found that somebody actually talks to me back, so I’m lost. But I AM 

        PUTTING A LOT OF EFFORT, I just don’t know what to do.

YOU: “post the code your having problems with”

ME: The problem is that I don’t have a code yet! I know how to do a few things, but all of them are in just one page, or one

       view, or one file main.lua, So all those things I can do, and I understand it, but I don’t know how to turn a page (gotoScene)

YOU: “A general “tell me how to do everything so I don’t have to” isn’t going to get many responses”

ME: And I don’t want people to tell me how, so I don’t have to… I WANT TO LEARN, so I know there is a way to change a view

       or goToScene, I KNOW THAT, but…

       1 .- Either I have not found someone who knows how to do it

       2.- Or they know, and they just don’t want to share it, or teach me

       3.- Or because they had SO MUCH trouble learning before, just like me today, now they want me to suffer, jut like they did

YOU: “Especially since your in the wrong subforum for storyboard”

ME: If you KNOW that I am in the “WRONG” place, would you be so kind to tell me how to get to the “RIGHT” place. And it took

       me 3 or 4 days to answer this, because I wanted to find out for myself, but I JUST CAN’T.

       Even if I AM in the WRONG place, this is the ONLY PLACE that at least I get people like you to tell me things, and I’m

       learning like that.

By the way my name it’s Victor M. Barba, if you Google my name you’ll see that I have a lot of books published already by the major music companies in the world. SO I WILL LEARN HOW TO MAKE AN APP, what ever it takes.

I hope you still can and want to help me and if you know how to gotoScene or change the page of my book, would you please tell me how in a very EXPLICIT WAY, I would really appreciated it.

Thank you Mourdos, and God bless you!

Victor

Hi Victor, have you had a chance to review the sample called Storyboard? It has 4 scenes and transitions between them. You can take this and tweak it to meet your needs. Alternatively, I think I recall seeing an eBook template for sale on the commercial section of this forum. I would think that the template developer would help you get up to speed if you wish to go that way. 

PS. No connection to the template developer mentioned and have no clue on the quality of his/her work. Was just an idea. 

Best of luck in your endeavor.

Thank you Ksan:

Where do I get that "Sample called Storyboard?

It should be in the following subfolder of your Corona installation : 

/CoronaSDK/SampleCode/Interface/Storyboard

"1 .- Either I have not found someone who knows how to do it

  2.- Or they know, and they just don’t want to share it, or teach me

  3.- Or because they had SO MUCH trouble learning before, just
like me today, now they want me to suffer, jut like they did"

I can guarantee nobody here wants you to suffer. :slight_smile:

We just don’t want to up and give you the code, not because we don’t want to help, but because we would actually be doing you a disservice - I think so anyway.
When it comes to learning to program, I’ve found that while studying and reading books on the subject can certainly help, actually creating a blank project and typing even just a few lines of code to display an image is far more valuable.

Have you tried looking at/experimenting with the various templates?
Corona Simulator > New Project >  Choose a template:
Blank
App
Game
E-book
Scene

If you did in fact read Burton’s book, then you should at least have a
understanding of various basic concepts and be able to experiment with the code included in Corona’s templates, and if not then I’d suggest re-reading the book and having a go at implementing some of the concepts he covers.

While it’s a good goal to try and challenge yourself, I’d suggest you try and make something very basic so you can get a firm understanding of the code&concepts that go into creating an app.

You can do it!! :smiley:

I’m going to move this to the storyboard forum.

OK helloworld2013,

You sound a little lost.  Did you download Corona SDK?  If so, that will contain a whole bunch of sample code, along with a Corona Simulator, which will run the codes.  It will not contain a text editor, which you will have to look for and download from the web.  I’m on a Mac and I use TextWrangler, but if your on a pc, just look for a good free code editor.  

Now, open the Corona SDK folder and look for Sample Code, then Interface, then Storybook.  Open the main.lua file in the simulator, and ALL of the .lua files in the text editor.  

Now start playing with the code.  The best way to learn what the code does and how it works is to mess with it.  Change numbers, save it, and see what it changed in the simulator.  Study every aspect of the code, and learn what it does.  Remember, whenever you change something in the code, save it, and see what it did in the simulator.  You can always undo anything that breaks the app.

Hope this is basic enough to get you started.

Thank you everyone for helping me, THANK YOU VERY MUCH!

I’m learning little by little, but I’m almost there to start making my books.

One more question – I’m adding a video to try to explaing the question better

http://www.youtube.com/watch?v=waa_Troorf4&feature=youtu.be

Thank you again for all your help.

I got the sound –

the storyboard –

the animation –

the background –

Good!

Victor

Great to hear of your progress!!! 

ksan, do you know how to answer the question I have in the video?

Awesome! glad you’re making progress! :slight_smile:

One question though -
On scene one, is that one entire background image or are those icons (what you are wanting to be buttons) individual images?

OK, it’s pretty simple.  Before you do anything, you’ll need to create images for your buttons as .png files.  Then, here’s how I do it.

--here you create the function to go to the new scene, my FUNCTION is called "gotobg" local function gotobg(e) storyboard.gotoScene( "bluegrass" ) end --then you need to create the button, and here is how i do it... "bgme" is my object name --and notice what it points to for the "onRelease" local bgme = ui.newButton{ default="bgbutton.png", over="bgbuttonover.png", onRelease=gotobg } bgme.x = display.contentWidth / 2 bgme.y = display.contentHeight / 2

That’s it.  Notice my image is called “bgbutton.png” and it’s .x and .y are set to be the middle of the screen. The scene I’m going to is called “bluegrass.lua”

*Everything* you need for creating a button is right here:
http://docs.coronalabs.com/api/library/widget/newButton.html

If you have a solid background and not individual images for buttons, then you’ll just need to create an invisible circle/rectangle and position it over the area where you want the button.
For invisible touch-sensitive buttons/whatever:

.isVisible = false;
.isHitTestable = true;

Also, check out this page: http://docs.coronalabs.com/api/event/touch/phase.html

 

I will post a video with all this answers, but first let me ask you this:

http://www.youtube.com/watch?v=ieli_AXLGwU&feature=youtu.be

Hi Saerothir, eieiosoftware, ksan…

I have this video trying the code that eieiosoftware, told me, I couldn’t make it work WHY?

http://www.youtube.com/watch?v=yxxuX9gpnPs&feature=youtu.be

programming is hard, I guess you must be really inteligent, to do this. (I think I am)… or I though I was!

Victor, I am sure you have all the intelligence needed. No need to question that! Learning to program is not much different than learning music. You need time and practice. Why not take a step back, buy a good book (ie Dr. Burton’s Corona book) and go through all the practice work? I think you might be trying to bite off too much too fast. Just my humble opinion. Wishing you all the success.

I bought the book already! Good book!

– Chapter I – the hello world is easy to understand and I got that, no problem

– Chapter 2 – Buttons and text, I got this one too, it’s okay

– Chapter 3 – Animation alpha, I got this too, a button than change the opacity of an object, got it!

– Chapter 4 – Simple calculator, – I don’t really need to create a calculator, but I more or less get this concept

– Chapter 5 - vector graphics, I got this one, no problem

– Chapter 6 - config.lua, adding sound, the beat-Box, I got this part!

–HERE IS THE PROBLEM–

Now it looks like another book, it goes too fast with many stuff

–Chapter 7 – The Director ? the modules packages ? …seeall ? CrawlerSpace?

–Chapter 8 – Physics, more or less

–Chapter 9 – that’s it! Too much Collision Detection? Game Loop? I just don’t really get all these.

– Cahpter 10 and 11 – more complicated SQLite? Json?

and more and more complicated…

Do you think if I hire someone to write the code I need, would I get better results?

Sounds like you have invested a lot of good time. The book covers Director which is a scene management system developed by a fellow developer on this forum. Now Corona Labs has its own scene management system called the StoryBoard which you have been learning through samples. For your purposes I would skip Physics, collision detection etc since they are more relevant to games. SQLite/Json might be relevant to you depending on how you intend to store and retrieve your lesson content. You’re on the right path.

Did you read any of the info in the links I posted?
They will tell you everything you want to know.

This is the format I use for when I create a function to change a scene:
[lua]
local function onBtn1Release(event)   
    
    – go to scene
    storyboard.gotoScene( “scene2”, “zoomInOutFade”, 700 )
    
            return true  – indicates successful touch
    end

[/lua]

Use the information provided in the link I posted above for creating a widget, button, and just reference the scene change function e.g.
[lua]
onRelease = onBtn1Release

[/lua]

Now since the icons you want to represent buttons are a part of the background image itself, then just forget these two lines:

default = “default.png”,
over = “over.png”,

and just define the size&location of the button.
Also, be sure to use
.isVisible = false;
.isHitTestable = true;

You’ll just be positioning an invisible rect that will receive touch-events.