Pong slides off the edge of the screen

Hi everyone, I am in the process of creating a ping pong game, and there is a small problem. When the ball in the game, hits the very edge of the pong, it begins to slide towards the middle:

https://www.youtube.com/watch?v=L05UZ0PekB4

The error begins at around 33 seconds. How could I prevent this from occurring?

1. I talked a little about this in my last answer to this thread: https://forums.coronalabs.com/topic/67839-attempt-to-call-getlinearvelocity-a-nil-value/#entry351107 
 
This is partly your ‘Manual Direction Changing’ code

2. My guess is the physics body is a square and not a circle… You can verify this by changing the drawmode to hybrid.  You want a circle.

3. I am also guessing you haven’t tweaked bounce and friction settings.

I actually wrote a bit of code a long time ago that addresses this kind of issue which you may find helpful:

https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2015/11/bouncy

https://www.youtube.com/watch?v=H2WXQUP6pL4

4. Great looking PONG by the way.  I know it’s simple, but I always get a kick when I see the simple layout.  

5. Finally, read the very last section in my post on your last thread.

Oh, and make the paddles “kinematic” bodies with isSleepingAllowed set to false.

Thanks. 

PS: I hope you noticed that in this folder is a copy of SSK. I am assuming it is obsolete.

Thanks, but I don’t see SSK in the folder (https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2015/11/bouncy)

Are you seeing something other than this:

bouncy_img.jpg

Perhaps, you have a local copy of RG_Freestuff where you already copied SSK2 into the bouncy folder?

Were you referring to this?

https://github.com/roaminggamer/RG_FreeStuff/tree/master/SSK2

This is free ‘extra’ content for SSK2 users.

If none of the above is correct, please post the link/URL where you are seeing a copy of SSK because I don’t want to distribute it accidentally.

-Ed

It was not a link, a found a folder that was called RG_FreeStuff-Master, and I don’t recall the download link you shared with me. I will try to look for it in my content. But, it is not SSK2, it is SSK. Also, it looks like the screenshot below. And then, another screenshot inside the SSK folder.

I tried looking through my downloads history on Google, and I think you may have already modified it, I had downloaded it August 24, 2016. However, I could send it to you, in a private conversation, so you could get a better idea of what it is. 

I do have a feeling you would not want this link to be downloaded too many times.

I will add an image of the entire folder structure.

Also, I recall that I did not move ssk2 into this folder, because it says ssk, not ssk2, and the files are different.

There are probably old copies of SSK 1 still floating around.  That’s OK.  Thanks for the concern though.

Cheers,

Ed

No problem.

1. I talked a little about this in my last answer to this thread: https://forums.coronalabs.com/topic/67839-attempt-to-call-getlinearvelocity-a-nil-value/#entry351107 
 
This is partly your ‘Manual Direction Changing’ code

2. My guess is the physics body is a square and not a circle… You can verify this by changing the drawmode to hybrid.  You want a circle.

3. I am also guessing you haven’t tweaked bounce and friction settings.

I actually wrote a bit of code a long time ago that addresses this kind of issue which you may find helpful:

https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2015/11/bouncy

https://www.youtube.com/watch?v=H2WXQUP6pL4

4. Great looking PONG by the way.  I know it’s simple, but I always get a kick when I see the simple layout.  

5. Finally, read the very last section in my post on your last thread.

Oh, and make the paddles “kinematic” bodies with isSleepingAllowed set to false.

Thanks. 

PS: I hope you noticed that in this folder is a copy of SSK. I am assuming it is obsolete.

Thanks, but I don’t see SSK in the folder (https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2015/11/bouncy)

Are you seeing something other than this:

bouncy_img.jpg

Perhaps, you have a local copy of RG_Freestuff where you already copied SSK2 into the bouncy folder?

Were you referring to this?

https://github.com/roaminggamer/RG_FreeStuff/tree/master/SSK2

This is free ‘extra’ content for SSK2 users.

If none of the above is correct, please post the link/URL where you are seeing a copy of SSK because I don’t want to distribute it accidentally.

-Ed

It was not a link, a found a folder that was called RG_FreeStuff-Master, and I don’t recall the download link you shared with me. I will try to look for it in my content. But, it is not SSK2, it is SSK. Also, it looks like the screenshot below. And then, another screenshot inside the SSK folder.

I tried looking through my downloads history on Google, and I think you may have already modified it, I had downloaded it August 24, 2016. However, I could send it to you, in a private conversation, so you could get a better idea of what it is. 

I do have a feeling you would not want this link to be downloaded too many times.

I will add an image of the entire folder structure.

Also, I recall that I did not move ssk2 into this folder, because it says ssk, not ssk2, and the files are different.

There are probably old copies of SSK 1 still floating around.  That’s OK.  Thanks for the concern though.

Cheers,

Ed

No problem.