The Bouncing Ball object is a physics-based entity designed to simulate highly accurate bouncing behavior, perfect for games such as Arkanoid, Pong or Breakout. Its behavior combines circular collisions, elastic rebound, and advanced angular control.
paddle).Speed X and Speed Y properties
define both the direction and the initial velocity of the ball.
The system does not normalize the speed automatically,
allowing you to control acceleration or slowing down using scripts.
If Angular Bounce is enabled and the ball collides with an object whose Tag
matches the value of Target Tag, the outgoing angle is dynamically calculated
based on the point of impact.
The closer the hit is to the center, the straighter the bounce;
near the edges, the angle increases up to the value defined by
Max Bounce Angle (Β°).
{
type: "ball",
name: "Bouncing Ball",
w: 32,
h: 32,
collision: true,
collisionType: "circle",
restitution: 1.0,
vx: 5,
vy: -200,
angularBounce: true,
angularBounceObjectTag: "paddle",
maxBounceAngle: 60
}
Tag specified in Target Tag,
an outgoing angle proportional to the impact position is calculated.speed parameter.You can modify the ballβs speed at any time using scripts:
function Update(obj, dt) {
// Increase speed by 5%
obj.vx *= 1.05;
obj.vy *= 1.05;
// Smoothly slow down
// obj.vx *= 0.97;
// obj.vy *= 0.97;
// Reverse X direction
// obj.vx = -obj.vx;
}
Math.hypot(obj.vx, obj.vy) and adjust velocity while keeping the same angle.
Target Tag = "paddle" in Pong or Arkanoid-style games.AudioSource component to play a sound on each hit.vx and vy
to increase speed or reverse direction.