SOS Signal

With the following code, 28 images are saved in the Document folder.

-- Flag set  to Documents Folder
-- Use this function to perform your initial setup
function setup()
    for i=1,28 do
    function(data,status,headers)imgM[i]=data end)    
    for i = 1,28 do
        if imgM[i] ~= nil then saveImage("Documents:M"..i,imgM[i]) end
-- This function gets called once every frame
function draw()


To use an example to those images.

--SOS Signal
function setup()
    print("SOS SOS")
    imgs = {}
    for i = 1,28 do
        imgs[i]="Documents:M"..i --load flags
    imgcount = {count = 1}
    delay  = 20 --Pause
    tween( delay,imgcount,{count = 28},{easing = tween.easing.linear,loop = tween.loop.forever})
    str="SOS - WE NEED HELP" --Title
function draw() 
    background(0, 0, 0, 255)
    sprite(imgs[28],WIDTH/2,HEIGHT/2 + 40)
    s = string.char(64+s)
    fill(244, 242, 242, 255)
    text(s,WIDTH/2,250 )

@matox - a few suggestions. They are not criticisms, I am trying to help.

  1. Because it is in the draw function, your code is trying to save the images repeatedly, 60 times a second, forever. I’m sure you only meant to do it once, so you should take the code out of draw() and put it in setup()

  2. rather than make a mess in your Documents folder with 28 separate images, why not put all of them onto a single image, eg made up of 7 rows x 4 columns, then read it in and use the image copy function to break it into 28 pieces?

  3. There is no need to write out the alphabet from A to Z. All these characters have a number code that runs in sequence, from 65 for A to 90 for Z, so all you have to say is

s = string.char(64+s)
  1. If you want to get more comments or help, I suggest you provide more details of what the code does. Saying that the code saves 28 images to Documents doesn’t sound very exciting, and most people won’t bother looking at what you have done. Also, other people can’t try your code because they don’t have your images - and they probably don’t want 28 extra images in their Documents folder!

@Ignatz Thanks for the suggestions.

To 1 and 3 : edit

On my iPad I lay with iExplorer for the images to a new folder.

iPad Folder.assetpack create. iPad connect via USB cable to the PC.

On the PC, create a new folder. Zbsp. - flags.assetpack -
In this folder store the files you want. (png - jpg - mp3)
Then start iExplorer on the PC.
Left click on Apps. Click on Codea folder. Click on Library folder.
Click and open on Asset Pack Downloads folder.
From the PC drag the folder you created here.