Need some feedback

-- mkay1
-- Use this function to perform your initial setup
function setup()
    
    
    print("Hello World!")
    print(WIDTH/2,HEIGHT/2)
    
    --player variables
    playerx = 20
    playery = 384 + 46
    -- cloud variables
    cloudx = 128
    cloudy = 600
    -- cloud 2 variables
    cloudx2 = 348
    cloudy2 = 648
    -- cloud 3 variables
    cloudx3 = 600
    cloudy3 = 549
    --cloud 4 variables
    cloudx4 = -156
    cloudy4 = 560
    --cloud 5 variables
    cloudx5 = -457
    cloudy5 = 643
    
end


function draw()
    --function loading
    cloudif()
    cloud_movement()
    
    background(0, 142, 255, 255)
    
    fill(124, 255, 0, 255)
    rect(0,0,749,384)
    --cloud drawing
    sprite("Platformer Art:Cloud 1",cloudx,cloudy)
    sprite("Platformer Art:Cloud 2",cloudx2,cloudy2)
    sprite("Platformer Art:Cloud 3",cloudx3,cloudy3)
    sprite("Platformer Art:Cloud 2",cloudx4,cloudy4)
    sprite("Platformer Art:Cloud 1",cloudx5,cloudy5)
    --player drawing
    sprite("Platformer Art:Guy Standing",playerx,playery)   
end

function touched(touch)
    if touch.x > WIDTH/2 then
        playerx = playerx + 200 * DeltaTime
    else playerx = playerx -200 * DeltaTime
    end
end

function cloud_movement()
    cloudx = cloudx + 1.3
    cloudx2 = cloudx2 + 1.2
    cloudx3 = cloudx3 + 1.2
    cloudx4 = cloudx4 + 1.4
    cloudx5 = cloudx5 + 1.4
end

function cloudif()
    
    if cloudx - 132 > 749 then
        cloudx = 0 - 132
    end
    
    if cloudx2 - 132 > 749 then
        cloudx2 = 0 - 132
    end
    
    if cloudx3 - 132 > 749 then
        cloudx3 = 0 -132
    end
    
    if cloudx4 - 132 > 749 then
        cloudx4 = 0 - 132
    end  
    if cloudx5 - 132 > 749 then
        cloudx4 = 0 - 132 
    end  
end

Hello,

I have been active on codea again unfortunatly i have a ipad 1 so i cant use the 2.0 version.
Aside from that i would like some feedback of this code because i kinda want to know how to make the player movement smoother and make the code smaller without getting stuff out of this little program.

Greetings mkay


function setup()   
    --player variables
    speed=0
    playerx = 20
    playery = 384 + 46
    -- cloud variables
    clouds={vec2(128,600),vec2(348,648),vec2(600,549),vec2(-156,560),vec2(-457,643)}
end

function draw()
    cloudif()
    cloud_movement()    
    background(0, 142, 255, 255)    
    fill(124, 255, 0, 255)
    rect(0,0,749,384)
    --cloud drawing
    for a,b in pairs(clouds) do
        sprite("Platformer Art:Cloud 1",b.x,b.y)
    end
    --player drawing
    sprite("Platformer Art:Guy Standing",playerx,playery)  
    playerx = playerx + speed * DeltaTime
end

function touched(touch)
    if touch.state==BEGAN or touch.state==MOVING then
        if touch.x > WIDTH/2 then
            speed=200
        else
            speed=-200
        end
    end
    if touch.state==ENDED then
        speed=0 
    end
end

function cloud_movement()
    local cloudSpeed={1.3,1.2,1.2,1.4,1.4}
    for a,b in pairs(clouds) do
        b.x=b.x+cloudSpeed[a]
    end
end

function cloudif()
    for a,b in pairs(clouds) do
        if b.x-132>749 then
            b.x=-132
        end
    end
end

@dave1707 wow really thanks! The moving function is alot smoother than first im breaking the code in pieces now to understand what it does but really, thanks!