beginner question

Hi,
I am trying to make my way through Corona, and not being a developer or with experience on other languages, I find very difficult to understand how to progress in the examples. Could I suggest that, since lua and corona are aimed also to people that do not have a programming experience (I am coming from design), to have a more beginner area which brings you through things with a more easy logic?
I am reading programming in Lua but it is very abstract, all the example here are single screens, something that will not happen in applications… I am embarrassed to post this, since everybody here seems to be way more ahead, but there is nothing on the net that brings you logically more ahead than a lot of hello worlds…

Right now I am trying to find my way through these very simple lines:

display.setStatusBar ( display.HiddenStatusBar )
system.activate( “multitouch” )

local ui = require(“ui”)

local background = display.newImage( “openingscreen.png” )

local button1 = ui.newButton{
default = “playbutton.png”,
over = “playbuttonover.png”,
}
button1.x = 140; button1.y = 240

function button1:tap(event)
local cave = display.newImage (“cave.jpg”)
local button2 =ui.newButton{
default =“movebutton.png”,
over = “movebuttonover.png”,
}
button2.x = 240; button2.y = 160;

function button2:tap(event)
local trog = display.newImage (“trog.png”)
trog.x = 120; trog.y = 100;
end
end
button1:addEventListener (“tap”, button1)
button2:addEventListener (“tap”, button2)

But I cannot make button2 to display the image trog…it does only the over, clicking nothing else happens…
What am I doing wrong? what should I read in order to understand how to manage sequential events maybe on successive screen.
I am really sorry to bother the forum, but I am really pretty lost

Thank you
[import]uid: 8464 topic_id: 2270 reply_id: 302270[/import]

The second END after your fucntion button2:tab(event), move that over that function. You defined a function inside a function.
Also you declare button2 local inside the tab listener of button1. so it is not defined later on. Make sure you change that.
It helps to run an app inside the simulator through the terminal. It will tell you if a object is undefined, I am pretty sure, it is. [import]uid: 5712 topic_id: 2270 reply_id: 6870[/import]

Hi mike
thanks for taking the time of reading my post. What I am trying to do is having a screen with a button that opens another screen. I understand now that as it is I am actually putting a full image on the top of what is already there… I am not actually going to another screen… If I may ask, how do I do that:
scree1 - button- screen 2 - button etc?
Many thanks
ps. and yes you are right it is undefined in the terminal [import]uid: 8464 topic_id: 2270 reply_id: 6872[/import]

Hi Pollen,

here is how I would do it:

  1. Create two groups, one for each screen.
  2. Then create two buttons.
  3. Insert one button into the first group, the other into the second.
  4. Make the second group invisible or move it out of the screen.
  5. Attach to each button a tap event listener. The first tap handler transitions the first group to be invisible or move it out of the screen and at the same time shows the second group. The second tap eventlistener does the opposite thing.

Does this help? [import]uid: 5712 topic_id: 2270 reply_id: 6874[/import]

Hi Mike,
thanks again for your time, I can follow your answer but I am lost for the skills ( for instance the invisible bit). I do not want to hassle you with silly questions since obviously I need to learn way more…my problem is how?
I started reading the LUA manual and it is very abstract, all the examples here are limited to core things probably very helpful to programmers but very confusing for a beginner.
Could you please tell me how should I proceed? I am in London and there are no courses on LUA, on line is all very vague, and I am really struggling and I would even pay for some private tutoring if I could find any…

Thanks
[import]uid: 8464 topic_id: 2270 reply_id: 6876[/import]

Hi Pollen,

no problem, everone has to start somewhere. Sometimes someone finds time to help, sometimes you are on your own. Give me a little bit of time, I am still at my day job.

When I have time tonight, I will create a little sample script to show you how I would do it.
Cheers
Michael

http://www.whiteskygames.com
http://www.twitter.com/mhartlef [import]uid: 5712 topic_id: 2270 reply_id: 6890[/import]

Hi Michael,
I subscribed to White Sky, you should find my email there it starts as andrea
Thank you for the Help

Andrea [import]uid: 8464 topic_id: 2270 reply_id: 6894[/import]

Hi Andrea,

here is the code sample. I hope it will help you a little bit:

[lua]local ui = require(“ui”)

display.setStatusBar( display.HiddenStatusBar )

grp1 = display.newGroup()
grp2 = display.newGroup()

–system.activate( “multitouch” )

local state=0
local background = display.newImage( “Blue2.png” )
grp1:insert(background)
local button1 = ui.newButton{
default = “Yellow_Button.png”,
over = “Yellow_Button.png”,
}
button1.x = 160; button1.y = 440
grp1:insert(button1)
local cave = display.newImage (“Black2.png”)
grp2:insert(cave)
local button2 =ui.newButton{
default =“Red_Button.png”,
over = “Red_Button.png”,
}
button2.x = 160; button2.y = 440;
grp2:insert(button2)
–grp2.x = -320
grp2.isVisible = false
function button1_touch(event)
print("button1_touch "…event.phase)
if state == 0 then
–transition.to(grp2,{x=0})
print(“tab1”)
state=1
grp2.isVisible = true
end
end
function button2_touch(event)
print("button2_touch "…event.phase)
if state == 1 then
–transition.to(grp2,{x=-320})
print(“tab2”)
state=0
grp2.isVisible = false
end
end
button1:addEventListener (“touch”, button1_touch)
button2:addEventListener (“touch”, button2_touch)[/lua] [import]uid: 5712 topic_id: 2270 reply_id: 6909[/import]

many thanks Michael,
it all makes sense and works even if it is not what I was aiming to conceptually…
You know your stuff and I really appreciate your help… I read you post on your blog and it would be nice to be able to exchange a few thoughts via email re: corona…
I left my email address in your list so it would be nice if we could have a chat if you do not mind. I really think you know what you are talking about (I refer as well of what you said in your blog)

Hope to hear from you and thanks again

Andrea [import]uid: 8464 topic_id: 2270 reply_id: 6989[/import]