Thanks!
It works, however I had to add a timer to it.
It seems, it is not the math, which causes the problem. No matter if I use the x cordinates to determine the exit, or the sensor, I always get an error, because it says, I attempt to perform arithmetic on field ‘x’ (a nil value).
It comes, because of my buttons (like this one)
[code]local buttonright = display.newImage( “images/right.png”,440,255 )
localGroup:insert(buttonright)
local function moveTargetRight( )
player.x = player.x + 2
if player.xScale == -1 then
player.xScale = 1
end
end
local function acceleratorright( event )
local this = event.target
local phase = event.phase
if “began” == phase then
– Start Focus
display.getCurrentStage():setFocus( this , event.id )
this.isFocus = true
Runtime:addEventListener( “enterFrame”, moveTargetRight)
elseif this.isFocus then
if “ended” == phase or “cancelled” == phase then
– End Focus
display.getCurrentStage():setFocus( this , nil )
this.isFocus = false
Runtime:removeEventListener( “enterFrame”, moveTargetRight)
end
end
end
buttonright:addEventListener( “touch”, acceleratorright )[/code]
If I move the player with x = x+2, on the exit it can’t calculate x+2 anymore and crashes.
At least I know now, how sensors work 
With the timer it works, but then I have another problem. But I make another topic for that. [import]uid: 6587 topic_id: 5714 reply_id: 19704[/import]