i need a little help

I’m working on a app with Codea end im using the code CurrentTouch.x and CurrentTouch.y and I need to know how to make two thing follow your finger at the same time I mean i have two things following my finger but I want to put the seacon thing some were else and make it still follow my finger please help me,


displayMode(FULLSCREEN)

function setup()
    x1=200
    y1=300
    x2=400
    y2=300
    dx,dy=0,0
end

function draw()
    background(40, 40, 50)
    sprite("Planet Cute:Character Boy",x1+dx,y1+dy)
    sprite("Planet Cute:Character Boy",x2+dx,y2+dy)
    if CurrentTouch.state==BEGAN then
        xs=CurrentTouch.x
        ys=CurrentTouch.y
    end
    if CurrentTouch.state==MOVING then
        dx=CurrentTouch.x-xs
        dy=CurrentTouch.y-ys
    end
    if CurrentTouch.state==ENDED then
        x1=x1+dx
        x2=x2+dx
        y1=y1+dy
        y2=y2+dy
        dx,dy=0,0
    end
end

@dave1707 how do you make it so the other sprite can’t be moved but the Frist one can?


displayMode(FULLSCREEN)

function setup()
    x1=200
    y1=300
    x2=400
    y2=300
end

function draw()
    background(40, 40, 50)
    sprite("Planet Cute:Character Boy",x1,y1)
    sprite("Planet Cute:Character Boy",x2,y2)
    if CurrentTouch.state==MOVING then
        x1=CurrentTouch.x
        y1=CurrentTouch.y
    end
end

@dave1707 oh I mean how do you make it he other sprite follow the Friste sprite but you can’t touch the other sprite and make it move


displayMode(FULLSCREEN)

function setup()
    x1=200
    y1=300
    x2=400
    y2=300
end

function draw()
    background(40, 40, 50)
    sprite("Platformer Art:Guy Standing",x1,y1)
    sprite("Tyrian Remastered:Evil Orb",x2,y2)
    if CurrentTouch.state==MOVING then
        x1=CurrentTouch.x
        y1=CurrentTouch.y
        x2=x2-(x2-x1)/25
        y2=y2-(y2-y1)/25
    end
end

@dave1707 XD thanks but it’s still not what I was looking for but thank you you are so nice I might talk to you later