Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Random Image (Code)
Started by dawidlipinski86 Nov 26 2018 10:35 AM

1 reply to this topic
randomimg random image randomimage image code help. sorryforenglish
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dawidlipinski86

[GLOBAL: userInfoPane.html]
dawidlipinski86
  • Observer

  • 2 posts
  • Corona SDK

Hello
I apologize for my broken English, I come from Poland.
 
Is there anyone who can help me? If so, thank you in advance.
 
I need a code for random images (Slides)
 
More specifically, I mean, when I cut the image from right to left (Touch.x), it showed a random image from 'myImages'
 
Once again, I apologize for my English
 
Greetings


[TOPIC: post.html]
#2

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 374 posts
  • Corona SDK

Hi @dawidlipinski86,

 

Try shuffle myImages table 

-- Somewhere near the start of your program
math.randomseed( os.time() ) 


local function shuffle( tbl )

    local rand = math.random
    local j

    for i = #tbl, 2, -1 do 

        j = rand( i ) 
        tbl[i], tbl[j] = tbl[j], tbl[i] 
   
    end 

    return tbl 

end
I'm also from Poland:) You can send me pm I will try help you.
 
 
 
Have a nice day:)
 
ldurniat

  • dawidlipinski86 likes this


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: randomimg, random image, randomimage, image, code, help., sorryforenglish