Bouncing ball, angle problem

For questions about using Classic.

Post » Thu Jul 21, 2011 10:19 pm

Anyone ever made a basic breakout type game.
4 walls, 1 paddle, and a ball with ball behaviour.

Sometimes the ball can get stuck in a sort of side to side loop as shown in the pic.
Could somebody tell me how to stop this happening ?



These are my settings for the ball:
Randomness          20
Bounce friction    off
Rotate object       off
Bounc off solids yes

Rotation              N angles
Rotation count     8

I did a search, but the links to the example files dont work.
B
21
S
5
G
8
Posts: 1,215
Reputation: 7,834

Post » Thu Jul 21, 2011 10:35 pm

Maybe add a random value to the ball.y when the ball.y before impact is the same after impact with a wall, if you get my drift.

I seem to remember such games as Arkanoid would sometimes do the same but would then veer off after a certain number of bounces.
zenox982011-07-21 22:54:23
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
87
Posts: 5,496
Reputation: 60,278

Post » Thu Jul 21, 2011 11:03 pm

[QUOTE=zenox98] Maybe add a random value to the ball.y when the ball.y before impact is the same after impact with a wall, if you get my drift.

I seem to remember such games as Arkanoid would sometimes do the same but would then veer off after a certain number of bounces.
[/QUOTE]

Good idea...I just added the following and it works ok:

+ ball5: On collision between ball5 and wall
+ ball5: Angle Less than 14
+ ball5: Angle Greater than 346
   -> ball5: Set angle to ball5.Angle-20

+ ball5: On collision between ball5 and wall
+ ball5: Angle Less than 194
+ ball5: Angle Greater than 166
-> ball5: Set angle to ball5.Angle-20

Thanks zenox98

B
21
S
5
G
8
Posts: 1,215
Reputation: 7,834


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests