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
22
S
5
G
5
Posts: 95
Reputation: 3,432

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! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Sep 15, 2011 2:54 pm

Helps a lot !


Thx !
"keep calm we have giant robots!"
B
22
S
5
G
5
Posts: 95
Reputation: 3,432


Return to How do I....?

Who is online

Users browsing this forum: alextro, MarkStockley and 0 guests