Moving A Sprite

Hi, 

I want to move a sprite from top left corner to top right and when the sprite bounce back to the top left but i do not know how to do this. Infact I just started learning lua few days back :frowning:
please help me out.

here is the code

– Hide Status Bar

display.setStatusBar( display.HiddenStatusBar ) 

 i=0

– Sprite

local sprite = require(“sprite”)

– Physics

local physics = require (“physics”)

– Variables

local background

– Background 

background = display.newImage( “bg.png” )

– Sprite

local sheet1 = graphics.newImageSheet( “image.png”, { width=32, height=32, numFrames=12 } )

local instance1 = display.newSprite( sheet1, { name=“bad”, start=7, count=3, time=1000 } )

instance1.x = 13

instance1.y = 16

instance1:play()

– Movement 

while i<display.contentWidth do

if i<display.contentWidth then

i=i+1

end

transition.to (instance1, {time=5000, x=i-10, y=16})

end

–transition.from (instance1, {time=5000, x=13, y=16})