Is there a problem with my event touch function?

Hey everyone,

I currently have set up an event touch function, which allows my character to successfully jump. I wanted to add a function where if the event.phase “moved” then the character would jump higher. Here is my code, and I would appreciate if someone could tell me what is wrong with it. Thanks!

[code]
function touched( event )
if event.phase == “began” then
if event.x < 241 then
if onGround then
monster.accel = monster.accel + 29
end
elseif event.phase == “moved” then
if event.x < 241 then
if onGround then
monster.accel = monster.accel + 32
end

return true

end
[import]uid: 175550 topic_id: 31033 reply_id: 331033[/import]

Try .y instead of .x [import]uid: 40033 topic_id: 31033 reply_id: 124079[/import]

I think because event moved phase do it after began. I mean this order:
Began -> Moved -> Ended
So it is possible began phase is executing.

Or that’s what i’m using in my code, at began phase i save start positions of x and y in move i do things and in ended i delete something. [import]uid: 116842 topic_id: 31033 reply_id: 124343[/import]

Try .y instead of .x [import]uid: 40033 topic_id: 31033 reply_id: 124079[/import]

I think because event moved phase do it after began. I mean this order:
Began -> Moved -> Ended
So it is possible began phase is executing.

Or that’s what i’m using in my code, at began phase i save start positions of x and y in move i do things and in ended i delete something. [import]uid: 116842 topic_id: 31033 reply_id: 124343[/import]