hey,
I do not know how to create a certain touch area.
Objective is to have a entire touch screen. If the touch is on an object then the touch event.x/ event.y will not be inside the object. It should automatically be placed next to the object. Up down Side what ever in - (~10px) to prvent a creation event on the colliding object.
Can someone help me with this?
Thanks in Advance!!!
\_CX = display.contentWidth\*0.5 \_CY = display.contentHeight\*0.5 \_CW = display.contentWidth \_CH = display.contentHeight \_T = display.screenOriginY -- Top \_L = display.screenOriginX -- Left \_R = display.viewableContentWidth - \_L -- Right \_B = display.viewableContentHeight - \_T-- Bottom aspectRatio = display.pixelHeight / display.pixelWidth local toucharea = display.newRect( \_CX, \_CX, \_CW, \_CH ) toucharea.id ="toucharea" toucharea.strokeWidth = 3 toucharea:setFillColor( 0.5 ) toucharea:setStrokeColor( 1, 0, 0 ) local function screenTouch( event ) local toucharea = event.target local eventX, eventY = event.x, event.y if ( event.phase == "began" ) then display.getCurrentStage():setFocus( toucharea ) Runtime:addEventListener( "enterFrame", enterFrame ) --MOD callMenu = true elseif ( event.phase == "moved" ) then elseif ( event.phase == "ended" ) then else end return true end egg1 = display.newRect(sceneGroup, \_CX,\_CY, 50, 50 ); egg1:setFillColor( unpack(colorTable) ) egg1.xScale=0.1 egg1.yScale=0.1 egg1.id = "egg1"; schlossZetra1 = false; transMegg1 = transition.to( egg1, { xScale=1, yScale=1, time=350, tag="transMegg1", transition=easing.outElastic } ) timer.performWithDelay( 400, function() physics.addBody( egg1, "static", { bounce=0.4, friction=1.0, filter=blueCollisionFilter } ); end) egg1.gravityScale = 0; egg1.isVisible = true; #--1. Touch event is for example: eventX, eventY = \_CX, \_CY #--2. Now I want that touch event take off the (distance to the borders of the Object [width or hight] and 20 px to have always a certain distance to objetc) from the eventX, eventY = \_CX, \_CY #--3. for example the if the touch event is x/y (\_CX,\_CY) and the objetc is egg1 then the touch event should be (\_CX -/+ 65, \_CY+/-65 ) # always 15px or more distance to object
If something is unclear please feel free to Write ask …
