Bullet Angles of Motion and Actual Angles

Get help using Construct 2

Post » Fri Aug 17, 2012 10:50 am

I've got a bit if a conundrum.

I would like objects when they collide with bullet behaviour to bounce off each other. I am using there current Angle of Motion plus 180 degrees.

This works well until I introduce solid objects, once they bounce then I am think that the angle of motion is no longer the angle they are actually going at.

Am I correct? If so is their anyway of accessing there actual angle of motion?

Thanks
B
9
S
2
Posts: 2
Reputation: 1,800

Post » Fri Aug 17, 2012 11:39 am

hmm i don't know if i understand what you want but try to use physics on the wall instead of solid or you can check this link it has the bounce with the ball and stuffs like that it may help you :
(from stemkoski)
http://www.scirra.com/tutorials/313/cloning-the-classics-breakout-video
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Fri Aug 17, 2012 1:39 pm

To calculate an objects angle of motion, create 2 instance variables for the object called 'PreviousX' and PreviousY'

at the end of your events add

Every Tick -> Object: Set PreviousX to X
              Object: Set PreviousY to Y

Then to calculate the objects actual angle of motion use Angle(Object.PreviousX,Object.PreviousY,Object.X,Object.Y)Baked2012-08-17 13:40:40
B
5
Posts: 15
Reputation: 737

Post » Fri Aug 17, 2012 1:48 pm

If your playing around with it remember that you can check a box on the object in the control panel "bounce off solids" yes/no.

Set to no then you can make them bounce off whatever you like (with a seperate event) but ignoring solids.GenkiGenga2012-08-17 13:50:44
ImageImage
B
73
S
16
G
6
Posts: 1,039
Reputation: 10,480

Post » Fri Aug 17, 2012 1:52 pm

To get the angle of motion of an object with the bullet behaviour you can simply use 'Object.Bullet.AngleOfMotion'.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Fri Aug 17, 2012 2:14 pm

Thanks for all the responses! I used this solution and it works like a dream. I went one step further and stored the angle as an instance variable too for easy access.

[QUOTE=Baked] To calculate an objects angle of motion, create 2 instance variables for the object called 'PreviousX' and PreviousY'

at the end of your events add

Every Tick -> Object: Set PreviousX to X
              Object: Set PreviousY to Y

Then to calculate the objects actual angle of motion use Angle(Object.PreviousX,Object.PreviousY,Object.X,Object.Y)[/QUOTE]

B
9
S
2
Posts: 2
Reputation: 1,800


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests