android
  #1  
Old 04-02-2010, 05:19 PM
keirien keirien is offline
Junior Member
 
Join Date: Feb 2010
Posts: 39
Default need help with coding in app

I making this app and i need to the code for repeating image

i was thinking it some like this

math.randomseed(os.repeat())

not sure
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 04-02-2010, 05:38 PM
Habhome's Avatar
Habhome Habhome is online now
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,080
Default

Be more descriptive in your thread title what you need help with, otherwise people may not bother to check the thread.

And how to you mean with repeating image? Be more descriptive with your problem. I can at least safely say that your suggested solution would not work to get any kind of image on the screen.
To get an image you first have to load one:
myimage = image.load("image.png")

Then you need to draw it to screen:
myimage:draw(xcoordinate, ycoordinate, width, height)
Exchanging the words for the value wanted

It has now been added to the screen buffer, to show it you need to update the screen:
screen.update()

Now an image has been drawn on the screen. But without a loop to catch the program it'll just exit immediately without giving you time to see it.

myimage = image.load("image.png")
While(true) do
myimage:draw(xcord,ycord,wid,hei)
screen.update()
os.sleep(5)
end

This will show an image, but it is impossible to quit the application since it's an eternal loop. Check other apps' main loop for ideas how to do it.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #3  
Old 04-02-2010, 06:26 PM
keirien keirien is offline
Junior Member
 
Join Date: Feb 2010
Posts: 39
Default

Quote:
Originally Posted by Habhome View Post
Be more descriptive in your thread title what you need help with, otherwise people may not bother to check the thread.

And how to you mean with repeating image? Be more descriptive with your problem. I can at least safely say that your suggested solution would not work to get any kind of image on the screen.
To get an image you first have to load one:
myimage = image.load("image.png")

Then you need to draw it to screen:
myimage:draw(xcoordinate, ycoordinate, width, height)
Exchanging the words for the value wanted

It has now been added to the screen buffer, to show it you need to update the screen:
screen.update()

Now an image has been drawn on the screen. But without a loop to catch the program it'll just exit immediately without giving you time to see it.

myimage = image.load("image.png")
While(true) do
myimage:draw(xcord,ycord,wid,hei)
screen.update()
os.sleep(5)
end

This will show an image, but it is impossible to quit the application since it's an eternal loop. Check other apps' main loop for ideas how to do it.
ok thanks would this code

myimage = image.load("image.png")
While(true) do
myimage:draw(xcord,ycord,wid,hei)
screen.update()
os.sleep(5)
end

work with two images in a countious loop?
Reply With Quote

  #4  
Old 04-02-2010, 06:33 PM
keirien keirien is offline
Junior Member
 
Join Date: Feb 2010
Posts: 39
Default

I making a strobe light

Please Habhome can you examine this code and explain it to me because i need your help
Attached Files
File Type: zip Strobe Light.zip (1.4 KB, 4 views)
Reply With Quote

  #5  
Old 04-02-2010, 07:12 PM
Habhome's Avatar
Habhome Habhome is online now
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,080
Default

Quote:
Originally Posted by keirien View Post
I making a strobe light

Please Habhome can you examine this code and explain it to me because i need your help
That code wouldn't do anything short of crash, to be honest. Do you want me to lay up the most basic code for a strobe app with comments so you can see what happens?

Or do you want me to do as I did with RobertsAccount and guide you through it via MSN?
(Whichever you choose, it'll have to wait for another day it's past 1AM and I want to sleep)
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #6  
Old 04-02-2010, 08:50 PM
keirien keirien is offline
Junior Member
 
Join Date: Feb 2010
Posts: 39
Default

Quote:
Originally Posted by Habhome View Post
That code wouldn't do anything short of crash, to be honest. Do you want me to lay up the most basic code for a strobe app with comments so you can see what happens?

Or do you want me to do as I did with RobertsAccount and guide you through it via MSN?
(Whichever you choose, it'll have to wait for another day it's past 1AM and I want to sleep)
you could lay up the most basic code for a strobe app with comments
Reply With Quote

  #7  
Old 04-03-2010, 07:09 AM
Habhome's Avatar
Habhome Habhome is online now
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,080
Default

Quote:
Originally Posted by keirien View Post
you could lay up the most basic code for a strobe app with comments
Here you have it. It's just flashing and exit when you press the home button.

Be careful with this code, I'm not sure what happened but I got a screen buffer error the first time I ran the code, but after a restart it didn't occur again. (See screenshot for the error)
Attached Images
File Type: jpg CIMG2988.jpg (80.6 KB, 15 views)
Attached Files
File Type: zip Strobe Light Hab Explained.zip (5.1 KB, 2 views)
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #8  
Old 04-03-2010, 07:25 AM
keirien keirien is offline
Junior Member
 
Join Date: Feb 2010
Posts: 39
Default

thanks
Reply With Quote

  #9  
Old 04-03-2010, 07:38 AM
keirien keirien is offline
Junior Member
 
Join Date: Feb 2010
Posts: 39
Default

Thanks Habhome for the code it helped me understand it a lot more.

I have one more thing i want to make a menu
so people can choose different colored strobe lights

thanks i really appreciate it
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 12:52 PM.