random flashcard

Dear fellow developers,

I have been thinking writing a “random flashcard app”. Unfortunately, I have no clue how to start. I would greatly appreciate it if you guys could kindly give me advice.

Most templates I have found are slide view apps. >_<

Regards,
Henry

Sydney, Australia [import]uid: 150748 topic_id: 29022 reply_id: 329022[/import]

Thats not a good place to start building an app from! :slight_smile:

All programming comes down to this:
Break the task into small chunks.

What do you need to do?

1/ Display a picture. Lots of code showing how to do that in the examples.
2/ Display a new one. The slide show app shows you one way to do that with an effect, but without an effect, kill the old picture and create a new one
3/ Decide which picture to show. While you work on ‘display the picture’, you will need to refer to the picture in some way. You might have 50 pictures included with your app, called picture01, picture02 and so on. When testing the display, just hard code the names. To display one randomly…
4/ Write a bit of code to return a random number. (math.random…)
5/Format that number into picture and use that to decide which picture to show next
6/ wrap that lot into an app, add a splash screen and an icon

7/Throw it away and do it again from scratch, knowing what you know now.
8/ Test test test test test

…then ship it [import]uid: 108660 topic_id: 29022 reply_id: 116810[/import]

Hi Jeff,
Thank you for your advice. I will keep it in mind.
Warm Regards,
Henry [import]uid: 150748 topic_id: 29022 reply_id: 116811[/import]

I plan to use factory.getRandom in my next app, but the thing is I cannot find any relevant information in Corona SDK documentation. Have it been removed? My next app will be a flash card, any suggestion? Thanks. [import]uid: 150748 topic_id: 29022 reply_id: 116826[/import]

I have also tried math.randomseed.
I copied from other guy’s sample code, but it doesn’t work for me.
I would appreciate it if you guys could kindly give me advice.
Thank you in advance.
Henry

local function randomImage ( )

math.randomseed( os.time( ) )
local imageToDisplay = “images/image” … tostring(math.random(2)) … “.png”
print (imageToDisplay)

local randomImage = display.newImageRect(imageToDisplay, 20, 20)

end

randomImage()

local randomImage = display.newImageRect(imageToDisplay, 20,20)

randomImage.x, randomImage. y = 160, 240

end [import]uid: 150748 topic_id: 29022 reply_id: 116828[/import]

I think you made the file name local.

Try this:

local function randomImage ( )

math.randomseed( os.time( ) )
local imageToDisplay = “images/image” … tostring(math.random(2)) … “.png”
print (imageToDisplay)

–Is the filename image1.png or image01.png?
–what does imageToDisplay contain at this point?

local randomImage = display.newImageRect(imageToDisplay, 20, 20)
randomImage.x, randomImage. y = 160, 240
end

randomImage() --this calls and displays the image
. [import]uid: 108660 topic_id: 29022 reply_id: 116832[/import]

_Thank you so much, brother.
Yes, it works this time.
You are a Corona guru!

:slight_smile:

Henry_

[import]uid: 150748 topic_id: 29022 reply_id: 116845[/import]

**Dear fellow developers,

“function getRandomOOO” has been removed from corona documentation?
I cannot find any information on the website, but I saw someone use it in the sample code before.
I will greatly appreciate it if someone could give me more information on “function get Random” Thank you in advance.

Regards,
Henry**
[import]uid: 150748 topic_id: 29022 reply_id: 116966[/import]