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
9
G
6
Posts: 138
Reputation: 5,129

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 Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,204
Reputation: 19,545

Post » Thu Sep 15, 2011 2:54 pm

Helps a lot !


Thx !
"keep calm we have giant robots!"
B
37
S
9
G
6
Posts: 138
Reputation: 5,129


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Nicolas951 and 14 guests