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
37
S
8
G
6
Posts: 136
Reputation: 5,040

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
109
S
38
G
17
Posts: 2,172
Reputation: 18,989

Post » Thu Sep 15, 2011 2:54 pm

Helps a lot !


Thx !
"keep calm we have giant robots!"
B
37
S
8
G
6
Posts: 136
Reputation: 5,040


Return to How do I....?

Who is online

Users browsing this forum: Ami Samad and 5 guests