Teleport

After working on my previous project for awhile, I came across a small problem. My project is meant to create two portals, both travel through. But I can only travel through one. Here is my code:

displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)

function setup()

px,py=300,400
hx,hy= 100,400
sx,sy=200,380

end

function draw()
background(40, 40, 50)
fill(181, 141, 64, 255)
stroke(255, 105, 0, 255)
strokeWidth(2)
ellipse(px,py,60,120)
fill(64, 76, 181, 255)
stroke(0, 17, 255, 255)
strokeWidth(2)
ellipse(hx,hy,60,120)
stroke(255)
line(50,340,350,340)
line(700,240,900,240)

sprite("Documents:Chell",sx,sy,100,100)


if px>sx-20 and px<sx+20 and py>sy-20 and py<sy+20 then
    sx = hx
    sy = hy
    

elseif hy>sx-20 and hx<sx+20 and hy>sy-20 and hy<sy+20 then
    sx = px
    sy = py

end

end

function touched(t)
if t.tapCount== 3 then
px=t.x
py=t.y
end
if t.state== MOVING then
sx=t.x
sy=t.y
end
if t.tapCount== 2 then
hx=t.x
hy=t.y
end
end

@Chell Don’t create multiple post for the same question.

Sorry, I got impatient

I know you want to get answers asap, but give us some time. We have other things to do during the day then watch the forum. We’ll answer questions as soon as we read them and determine what’s wrong. I’m working on your problem right now.

Closing.