"What to do if your object gets stuck in a wall or something, when it should stop or bounce. " ... I have seen the question been asked Sooo many time now, I just had to write something about it.
move_bounce_all(true);
speed = 0;
Logically, if you want an object to stop when hitting a wall, or the ground (in a platform game for example, where gravity is constantly pushing it down) you'd set speed to zero. But there are several problems that might occur: the object might go through the wall, or just a little bit into it before it stops, it might begin to shake or have other side effects.
The code I presented above, however, is flawless and I think the easiest solution to your problem is to just replace your code (speed=0 or whatever it is) with mine.
<b>Your situation might be different</b> but usually this would work. Please comment and tell me if it worked for your. I'd like to know.
.
Users logged in:
Comments
Loading comments...