Hello everybody, I’m having a really strange problem with my game, I can’t manage to fix it.
In my code, I’m creating a rectangle at the top of the screen, then I add a touch listener to it.
The problem is that I can only touch the left part of the button, because the right part just doesn’t react.
But when I place the button at the bottom of the screen it works nicely.
Here’s how to reproduce the “bug” :
module(..., package.seeall) new = function ( params ) local localGroup = display.newGroup() --================================== --Forward functions --================================== local onTouchButton --================================== --Create variables & displays --================================== local background local button --================================== --Functions --================================== onTouchButton = function(e) if e.phase == "began" then display.currentStage:setFocus(button) button.alpha = 0.6 button:setFillColor(80/255,80/255,80/255) elseif e.phase == "ended" then display.currentStage:setFocus(nil) button.alpha = 0.3 button:setFillColor(200/255,200/255,200/255) end end --================================== --Image Displays --================================== button = display.newRect(display.contentWidth/2,100, display.contentWidth,100) button:setFillColor(200/255,200/255,200/255) button.alpha = 0.3 button:addEventListener("touch",onTouchButton) --================================== --Functions --================================== button:addEventListener("touch",onTouchButton) return localGroup end
Oh, and also, I would like to say that I’m using the Director class.
Thanks you for your support,
Ulysse.