# Bouncing Ball issue

This forum is currently in read-only mode.
0 favourites
• 4 posts
From the Asset Store
Bouncing ball
\$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
• I have made these two caps to illustrate an issue I'm having with the Ball behaviour.

The BB cap uses the ball behaviour. The ball has no randomness, so it should bounce at a steady 45 degree multiple. However, if you use the debugger, you can see that the bouncing has a very obvious variance to it.

The CMB cap uses the custom movement behaviour. The angles for speed, angle and collision response are basically the same, but in this case the ball bounces exactly as I expect it to.

Why is this? I don't have a problem using CMB for these things, but it would be so much more logical to use a ball. As far as teaching goes, I don't want to have to tell my students "don't use the ball behaviour for the ball".

On a side note - I could display the angle of movement for the CMB in the text object using the expression "Ball[CustomMovement].Angle", but I couldn't do the same thing with the Ball behaviour. Is there a way to do this?

• hehe cool, I made the Custom Movement Behaviour and its great to see it works so accurately! The ball movement was written a year ago and seeing as the code in CMB appears to work better for bouncing we'll probably end up incorporating the new code into the Ball Movement so it bounces as expected.

I'd recommend using the CMB over the bouncing ball because it has more functionality and I plan to add more actions to do easy stuff like gravitationally pull an object towards another object or position etc.

If you tick the 'rotate object' option, you can use Sprite.Angle to get the angle of motion. Otherwise, you will need to do something like this:

angle(0,0,Sprite[Ball].VectorX, Sprite[Ball].VectorY)

to get the angle out of the x and y components, which is rather ugly

As for teaching your students, maybe it can be a valuable lession not to judge something by its name. Just coz a program is called 'FPS Creator' doesn't mean its the best program to use if you want to make a 3d first person shooter. Although I agree a bouncing ball should bounce at least as well as the custom movement behaviour.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Looks like David beat me to it.

...mmh yeah wut he said, all of it.

Oh and if you don't want the actual angle shown you can use set animation angle.

Btw looks like we need a get animation angle call.

• Thanks for the reply guys. My plan was to introduce the CMB later on when things start to get more complicated. For the first couple of lessons, making games like PONG/Breakout, I was hoping to be able to keep things simple, i.e. Ball, 8-Way, etc. No big deal - the students probably won't even notice the inaccuracy (just my own perfectionism rearing its ugly head), and those that do can be pointed in the direction of the CMB.

As far as the expression is concerned, I was just wondering why "Ball[CustomMovement].Angle" works, but "Ball[Ball].Angle" doesn't.