Ball Behaviour

Get help using Construct 2

Post » Thu Sep 15, 2011 2:24 pm

Guys,

Any sugestion for a "pong ball behaviour like" movement ?

Cheers

Amarcelo
"keep calm we have giant robots!"
B
29
S
8
G
6
Posts: 121
Reputation: 4,740

Post » Thu Sep 15, 2011 2:44 pm

When the ball collides with a solid or wall object, set its angle to

Ball.Angle + 160 + random(40)

That will change its direction by 160 to 200 degrees.

Next use an always event to move it by private variable "Speed"

X = Ball.X + Speed * Cos(Ball.Angle - 90)
Y = Ball.Y + Speed * Sin(Ball.Angle - 90)

Hope that helps!Jayjay2011-09-15 14:44:56
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
95
S
33
G
14
Posts: 2,120
Reputation: 16,493

Post » Thu Sep 15, 2011 2:54 pm

Helps a lot !


Thx !
"keep calm we have giant robots!"
B
29
S
8
G
6
Posts: 121
Reputation: 4,740


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests