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

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! (they wont run anywhere)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
125
S
42
G
17
Posts: 2,228
Reputation: 19,918

Post » Thu Sep 15, 2011 2:54 pm

Helps a lot !


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


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, Google [Bot] and 18 guests