Got to dig a trench about 120 feet long for a water line
Guess I want be working on the game for awhile [import]uid: 7911 topic_id: 3454 reply_id: 303454[/import]
Hi I need some help, if I understand your post…
pollen [import]uid: 8464 topic_id: 3454 reply_id: 10360[/import]
nope i was asking for help to dig but im taking a break and ill try to help you out whats the problem [import]uid: 7911 topic_id: 3454 reply_id: 10361[/import]
Ok, cool I get it… sorry for not being able to help for the digging I am probably too far away (london usually but now in jamaica)…
Anyway I am trying to buid some display.new group (screens) and I get everything right for the first 2 but at the third which is my group 4 everything goes haywire…and I do not know why since I am a beginner… I could post the line of code if you are in the mood for helping me out, but I ask you first since the digging bit is already pretty challenging
Andreas [import]uid: 8464 topic_id: 3454 reply_id: 10362[/import]
yeah show me some code
im about half way on the digging so taking an extended break [import]uid: 7911 topic_id: 3454 reply_id: 10364[/import]
ok the part that send everything haywire is the commented bit:
(local double sky) grp4
Many thanks
Andrea
local ui = require(“ui”)
display.setStatusBar ( display.HiddenStatusBar )
grp1 = display.newGroup()
grp2 = display.newGroup()
grp3 = display.newGroup()
grp4 = display.newGroup()
–system.activate( “multitouch” )
local state=0
local background = display.newImage( “openingscreen.png” )
grp1:insert(background)
local button1 = ui.newButton{
default = “playbutton.png”,
over = “playbuttonover.png”,
}
button1.x = 140; button1.y = 240
grp1:insert(button1)
local button3 = ui.newButton{
default = “options.png”
}
button3.x = 100; button3.y = 60
grp1:insert(button3)
local button4 = ui.newButton{
default = “credits.png”
}
button4.x = 400; button4.y = 80
grp1:insert(button4)
local cave = display.newImage (“cave.png”)
grp2:insert(cave)
local button2 = ui.newButton{
default = “mainmenu.png”
}
button2.x =400; button2.y = 240;
grp2:insert(button2)
–grp2.x =-320
grp2.isVisible =false
local sky = display.newImage (“sky.jpg”)
grp3:insert(sky)
local button5 = ui.newButton{
default = “mainmenu.png”
}
button5.x =140; button5.y = 160;
grp3:insert(button5)
–grp2.x =-320
grp3.isVisible =false
–[[local doubleSky = display.newImage (“sky.jpg”)
grp4:insert(doubleSky)
local button6 =ui.newButton{
default = “mainmenu.png”
}
button6.x = 140; button6.y = 160;
gpr4:insert(button6)
grp4.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 button3_touch (event)
print(“button3_touch”…event.phase)
if state == 0 then
–transition.to(grp3,{x=0})
print(“tab1”)
state=1
grp3.isVisible =true
end
end
function button4_touch (event)
print(“button4_touch”…event.phase)
if state == 0 then
–transition.to(grp4,{x=0})
print(“tab1”)
state=1
grp4.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
function button5_touch(event)
print(“button5_touch”…event.phase)
if state == 1 then
–transition.to(grp2,{x=-320})
print(“tab2”)
state=0
grp3.isVisible = false
end
end
function button6_touch(event)
print(“button6_touch”…event.phase)
if state == 1 then
–transition.to(grp2,{x=-320})
print(“tab2”)
state=0
grp4.isVisible = false
end
end
button1:addEventListener (“touch”, button1_touch)
button2:addEventListener (“touch”, button2_touch)
button3:addEventListener (“touch”, button3_touch)
button4:addEventListener (“touch”, button4_touch)
button5:addEventListener (“touch”, button5_touch)
button6:addEventListener (“touch”, button6_touch)
[import]uid: 8464 topic_id: 3454 reply_id: 10366[/import]
describe what you mean by haywire whats happening or email me the code with images @ jstrahan73 gmail com [import]uid: 7911 topic_id: 3454 reply_id: 10369[/import]
put
\<lua\>
\</lua\>
around your code in the forum and it’ll format better!
j [import]uid: 6645 topic_id: 3454 reply_id: 10370[/import]
Shouldn’t this grp2.x =-320 (I realize this is a comment, but all the references are in the same format)
and all other references to grp2 objects be:
–grp2[1].x =-320
You’d think it’d make the x value of the whole group -320, but in my testing I’ve found it doesn’t work, you have to specify the index of the object you want to position. Or use something like:
[lua]for i=1, grp2.numChildren do
grp2[i].x =-320
end[/lua]
I hope it helps. [import]uid: 10835 topic_id: 3454 reply_id: 10599[/import]