player/circle movement

hi guys i havent been coding with codea because i have been caught up by a depression.

but i have a simple circle in my code and i want to move left if i touch the left side of te screen and move right when touching the right.
can somebody help me with that?

i can post a bit of my code if you want to.

-- player move

function setup()
--player variables
    player_x = 250
    player_y = 250
    player_height = 50
    player_width = 50
    player_speed = 50
--
    
end

function draw() 
    background(40, 40, 50)
    fill(200,120,200)
    ellipse(player_x, player_y, player_width, player_height)
    
end

function player_move()
    if  
end




@Jessevanderheide - try this instead of your player_move function

function touched(t)
    if t.x<WIDTH/2 then 
        player_x=player_x-player_speed
    else
       player_x=player_x+player_speed
    end
end

@Ignatz thanks for showing me but can you explain what that t does?

@Jessevanderheide Just in case you want to try other movements, move your finger around anywhere on the screen.


displayMode(FULLSCREEN)

function setup()
    dx,dy=0,0
    x=WIDTH/2
    y=HEIGHT/2
end

function draw()
    background(40, 40, 50)
    fill(255)
    ellipse(x+dx,y+dy,50)
end

function touched(t)
    if t.state==MOVING then
        dx=dx+t.deltaX
        dy=dy+t.deltaY
    end
end

Read this

http://coolcodea.wordpress.com/2013/03/26/11-handling-touches-simple-pinch-and-zoom/

t is just a table of information about the touch.
x & y are the position of the touch and are accessed like this:

X=t.x
Y=t.y

They are read-only because they are userdata from C

@dave1707 @Ignatz @Coder thanks all, i will look at them and try to learn from them.
if codea is similar to love2D i will get a good start