abi>>forums

abi>>forums (http://www.anythingbutipod.com/forum/index.php)
-   Zen X-Fi2 Applications & Development (http://www.anythingbutipod.com/forum/forumdisplay.php?f=221)
-   -   Hey I'm not very familiar with lua and wonder if anyone can help me? (http://www.anythingbutipod.com/forum/showthread.php?t=63221)

TexMex 05-21-2011 05:25 AM

Hey I'm not very familiar with lua and wonder if anyone can help me?
 
Just for basic information, so I wonder if anyone can make an easy app that contains a menu with two buttons start and close with a black background. If you press start, the two buttons will disappear and it pops up a ball, when you move the x fi-2 the ball is rolling that way you move it. You can press the home button for returning to the menu. If you press close then stop the program.

Can anyone help me? It would have been enough for me to teach me the basic of "creative lua".:D

TexMex 05-21-2011 07:43 AM

This is what i got so far!
 
sheight = screen.height()
swidth = screen.width()

imgback = image.load("background.png")
imgstart = image.load("start.png")
imgclose = image.load("stopp.png")
imgball = image.load("ball.png")

touch_x = 0;
ytouch_ = 0;

imgback.draw(0,0,399,230);
imgstart.draw(50,50,150,150);
imgclose.draw(200,50,150,150);
imgscreen.update();
control.read(1)

function hi()
imgstart:close();
imgclose:close();
imgball.draw(200,115);
screen.update

while 1 do
if x >= 50 and x <= (50 + 150) and y >= 150 and y <= (150 + 50) then
hi();
end
end

jbob182 05-21-2011 08:31 AM

Here is the code:
http://snipt.org/xKli

I hope this helps.

TexMex 05-21-2011 09:12 AM

Thank you for taking the time to help
 
Thank you for taking the time to help:D
This was useful:p

TexMex 05-22-2011 06:02 AM

The program works fine.
 
The program works fine, but when I close the program and run it again then I get up the menu for about 1 sec before it closes, do you know what's wrong?

I also want the home.button to go back to my menu not to applications so any idea.

Thanks for all replies!!!

jbob182 05-22-2011 08:05 AM

Quote:

The program works fine, but when I close the program and run it again then I get up the menu for about 1 sec before it closes, do you know what's wrong?
As yes i think i do, the way i made this, when you click the application it will also check for any button clicks

As for the home button, you simpliy put in an if statement like so
if button.click() == 1 then
if menu == "menu" then
break
elseif menu == "gameplay" then
menu="menu"
end
end

I will update the code to include this and some changes


TexMex 05-22-2011 01:14 PM

Thank you for helping
 
Thank you for helping me but when I press the home.button I come back to the menu, but if I click on something i quite the program and if I start it again and click on something the the same thing is happening.


it would be very nice if you could have this application to work fine.

Thank you for helping me to learn lua for ZEN xfi2:cool:

jbob182 05-22-2011 07:27 PM

Keep in mind i am not actually testing my work :) I will look into these bugs you speak of.

TexMex 05-23-2011 03:44 AM

I understand that you don't bother to test it.
 
I understand that you don't bother to test it.

thank you for looking into these bugs:)

I am looking forword to pingus dude :D
keep up the good work.


All times are GMT -5. The time now is 09:11 AM.