Ok I know this question has been asked before but never seem to have found a solution to it. If its for invisible walls or even an object that counts as your wall so characters stays on screen then you`re better off using a function to keep your character on screen with a Runtime event listener [IMO]. The real problem is if you have objects on screen that your character will collide against in a tilt base game no matter what changes I do to the character or static object the result is always the same. I tried changing the density or bounce to see if when character collides maybe it bounces back to avoid character going through the object. I even tried doing a little cheat like setting the character velocity to 0, 0 or if character collides from left side set linear velocity to -(number) , 0 to simulate a push but nothing seems to give good results. It seems with enough tilt the character will just go through or half way through the object! Is there a work around this?
Here is a sample to keep character on screen if you are wondering how. Obviously you will mess with the numbers base on your game and character size.
[lua]local function NameYourFunction(event)
– Left Side of screen
if YourCharacter.x < 20 then
YourCharacter.x = 20
end
– Right Side of screen
if YourCharacter.x > 300 then
YourCharacter.x = 300
end
– Top Side of screen
if YourCharacter.y < 0 then
YourCharacter.y = 0
end
– Bottom Side of screen
if YourCharacter.y > 480 then
YourCharacter.y = 480
end
Runtime:addEventListener(“enterFrame”, NameYourFunction) [import]uid: 30314 topic_id: 17721 reply_id: 317721[/import]
[import]uid: 12482 topic_id: 17721 reply_id: 67649[/import]