Getting variation in angle of motion for bullet behaviour

Just started using Construct 2? Post your questions here

Post » Fri Mar 13, 2015 9:24 pm

Basically, I have it where a ball (via bullet) follows the same angle of motion when bouncing off another object. Even if the ball hits a different side of the object. I still want the angle of motion to follow the same kind of arc (for gameplay purposes) but I want to introduce some slight variation (by 5 degrees) into the angle of motion if the ball hits specific areas of the object. Like this:
Image

Can this be done in bullet behaviour? Perhaps by calling different image points (but what should I bring up in the event panel to do that)?

EDIT: Forgot to add it, but imagine there being a bounding box around the object. So, dead center bounces out at 285, from the center to the top left at 280 and on the entire left side at 275.
B
8
S
1
G
1
Posts: 34
Reputation: 473

Post » Sun Mar 15, 2015 5:33 pm

if you already have the bounce done, and simply want to "add variation", try:


set angle: Self.Angle + choose(-5,-4,-3,-2,-1,0,1,2,3,4,5)


It will randomly pick one of the values from choose and will add/withdraw :)
Who dares wins
B
53
S
13
G
11
Posts: 1,752
Reputation: 13,818


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest