I found some code on here to randomly load images I have created when user shakes the device (I forgot where I got it so if you recognize it THANK YOU!). Each time the program loads in the simulator it starts with a black screen, then you have to shake to start seeing the images. I want to have an intro image always load on start up and then never load again once the shaking and randomness start.
How can I do this?
Here is the code I’m using (not sure how you make the code look like it does in text Wrangler):
local img = { “cleanup.gif”, “distortion.gif”, “heart.gif”, “opposite.gif”, “randomize.gif”, “showoff.gif”, “stupid.gif” };
local function onShake(event)
if event.isShake then
local r = math.random(0, #img);
local image = display.newImage(img[r], 0, 0);
end
return true;
end
Runtime:addEventListener(“accelerometer”, onShake);
And to make it even cooler are there some effects or transitions I can apply to each image load?
Thanks
[import]uid: 28819 topic_id: 5661 reply_id: 305661[/import]