When controlling a character using d-pad on level1.lua, if you click the a button the character just keeps going and going. But when I change it to main.lua, it works fine [import]uid: 132369 topic_id: 24241 reply_id: 324241[/import]
Will be an error in code somewhere. See this tutorial with dpad; http://techority.com/2011/05/01/using-sprites-in-your-corona-iphone-application/ (I know it says it is about sprites but it also contains dpad sample working perfectly.) [import]uid: 52491 topic_id: 24241 reply_id: 98190[/import]
Thanks for replying peach. My codes work perfectly fine on “main.lua” but not on “level1.lua”. I have also looked at your tutorial. My codes for d-pad are
[lua]local penguin = display.newImage(“penguin.png”)
penguin.x = 240
penguin.y = 225
physics.addBody(penguin, “static”,{radius=45})
– ARROWS –
local left = display.newImage (“leftx.png”)
left.x = 30
left.y = 260
local right = display.newImage (“rightx.png”)
right.x = 110
right.y = 260
– Puts in all four movement arrow images and positions them
– MOVE PEACH –
local motionx = 0
local speed = 10
– Speed can be adjusted here to easily change how fast my picture moves. Very convenient!
local function stop (event)
if event.phase ==“ended” then
motionx = 0
end
end
Runtime:addEventListener(“touch”, stop )
– When no arrow is pushed, this will stop me from moving.
local function movepenguin (event)
penguin.x = penguin.x + motionx
end
Runtime:addEventListener(“enterFrame”, movepenguin)
– When an arrow is pushed, this will make me move.
function left:touch()
motionx = -speed
end
left:addEventListener(“touch”,left)
function right:touch()
motionx = speed
end
right:addEventListener(“touch”,right)
– The above four functions are stating the arrows should all listen for touches and defining
– the way I should move based on each touch.
local function wrap (event)
if penguin.x < 50 then
penguin.x = 50
end
if penguin.x > 430 then
penguin.x = 430
end
if speed < 0 then
speed = 0
end
end
Runtime:addEventListener(“enterFrame”, wrap)
[import]uid: 132369 topic_id: 24241 reply_id: 98323[/import]
Hey again,
The code looks OK to me but I feel like I must be missing something as I’ve used this plenty of times in different scenes without issue.
Would you be comfortable uploading your current project and posting a link? If so I will take a look at it.
If not, perhaps post a project with artwork replaced with random images or the like?
This is going to bother me until we get you sorted out so if you could do either of the above would be great.
Also, let me know what version of Corona you’re currently running.
Peach
[import]uid: 52491 topic_id: 24241 reply_id: 98428[/import]
Yes thank you so much. Where do you want me uploading my project ?
[import]uid: 132369 topic_id: 24241 reply_id: 98433[/import]
Save the “thanks” until I’ve helped you fix it 
If you have dropbox or a server or the like put it up and post a link else you can email it to me if you wish, peach[at]anscamobile
[import]uid: 52491 topic_id: 24241 reply_id: 98478[/import]
I have sent the folder to your email [import]uid: 132369 topic_id: 24241 reply_id: 98521[/import]
I just updated it in your dropbox - check it out, should all be working fine now.
Issue was that you had errors relating to Director. (There was an error message in the terminal.)
Anyway I fixed it and also wrote a suggestion for your collision function that I think you will find works slightly better 
Let me know what you think.
Peach
[import]uid: 52491 topic_id: 24241 reply_id: 98527[/import]
Thanks Peach. Is there anyway I could give you money through the internet ? [import]uid: 132369 topic_id: 24241 reply_id: 98529[/import]
As I think I said in my email (I’m not sure, it was about 6am and I was exhausted) you can always donate via http://Techority.com/ if you want to - however you aren’t under any obligation.
Really the best thing to do is “pay it forward”, what you learn you try to teach others who also need help in the community 
Peach [import]uid: 52491 topic_id: 24241 reply_id: 98695[/import]