Does adding a "static" physic body causes the Corona to skip a touch phase?

Hi,

It’s strange that when I run this code
jet = display.newImage("redJet.png", 0, 0) jet.x, jet.y = 100, 100 physics.addBody(jet, "static", {density = 0.1, bounce = 0.1, friction = 0.2, radius = 12}) jet.enterFrame = actiaveJets screenGroup:insert(jet)[/code]And then later this[code]function actiaveJets(self, event) self:applyForce(0, -1.5, self.x, self.y)endfunction touchScreen(event) if event.phase == "began" then Runtime:addEventListener("enterFrame", jet) end if event.phase == "ended" then Runtime:removeEventListener("enterFrame", jet) endend[/code]To attach and remove the event listener, if I add that jet as "static", I get the first touch phase as "began" but if I change it to "dynamic", the first touch event I get will be either "moved" or "ended" !If you press the screen two times, the second touch will be good and you will get the "began" phase but you have to touch the game twice!As you can see, it's very important to have the correct touch phase because my object is falling down and with the touch event I push it up.Please note that I'm using storyboard API, wondering that if this affects these stuff.Why is that? [import]uid: 206803 topic_id: 35559 reply_id: 335559[/import]

I think problem somehow lies with the previous scene. Because if I go directly from main.lua file (which is just an entry point and has a gotoscene call), both lines seem to work.

I think I’m doing something wrong here, like not removing an event listener or something that messes with the another scene. Here is my initial scene that I load before this one:

[code]
local storyboard = require(“storyboard”)
local scene = storyboard.newScene()
function scene:createScene(event)

– Load GFX

local screenGroup = self.view – [Probably] so we can remove all graphics at once.

background = display.newImage(“start.png”);
screenGroup:insert(background)

city1 = display.newImage(“city1.png”);
city1:setReferencePoint(display.BottomLeftReferencePoint)
city1.x, city1.y = 0, 320
screenGroup:insert(city1)

city2 = display.newImage(“city2.png”);
city2:setReferencePoint(display.BottomLeftReferencePoint)
city2.x, city2.y = 0, 320
screenGroup:insert(city2)

end

function start(event)
if event.phase == “began” then
storyboard.gotoScene(“game”, “fade”, 400)
end
end

function scene:enterScene(event)
– Add event listeners
background:addEventListener(“touch”, start)
end

function scene:exitScene(event)
– Remove event listeners
background:removeEventListener(“touch”, start)
end

function scene:destroyScene(event)

end

scene:addEventListener(“createScene”, scene)
scene:addEventListener(“enterScene”, scene)
scene:addEventListener(“exitScene”, scene)
scene:addEventListener(“destroyScene”, scene)

return scene

[/code] [import]uid: 206803 topic_id: 35559 reply_id: 141334[/import]

I think problem somehow lies with the previous scene. Because if I go directly from main.lua file (which is just an entry point and has a gotoscene call), both lines seem to work.

I think I’m doing something wrong here, like not removing an event listener or something that messes with the another scene. Here is my initial scene that I load before this one:

[code]
local storyboard = require(“storyboard”)
local scene = storyboard.newScene()
function scene:createScene(event)

– Load GFX

local screenGroup = self.view – [Probably] so we can remove all graphics at once.

background = display.newImage(“start.png”);
screenGroup:insert(background)

city1 = display.newImage(“city1.png”);
city1:setReferencePoint(display.BottomLeftReferencePoint)
city1.x, city1.y = 0, 320
screenGroup:insert(city1)

city2 = display.newImage(“city2.png”);
city2:setReferencePoint(display.BottomLeftReferencePoint)
city2.x, city2.y = 0, 320
screenGroup:insert(city2)

end

function start(event)
if event.phase == “began” then
storyboard.gotoScene(“game”, “fade”, 400)
end
end

function scene:enterScene(event)
– Add event listeners
background:addEventListener(“touch”, start)
end

function scene:exitScene(event)
– Remove event listeners
background:removeEventListener(“touch”, start)
end

function scene:destroyScene(event)

end

scene:addEventListener(“createScene”, scene)
scene:addEventListener(“enterScene”, scene)
scene:addEventListener(“exitScene”, scene)
scene:addEventListener(“destroyScene”, scene)

return scene

[/code] [import]uid: 206803 topic_id: 35559 reply_id: 141334[/import]