How do I destroy?

Get help using Construct 2

Post » Wed Jul 29, 2015 9:54 pm

hey guys,

we all know that a square has 4 sides I will call them 1 2 3 and 4

I have a ball that will collide with this square what I want to happen is this:

if ball collides with side 1 3 destroy ball

any ideas? please help.
B
11
S
2
G
1
Posts: 84
Reputation: 852

Post » Wed Jul 29, 2015 10:40 pm

if the ball if significantly smaller than the square, compare their positions when they collide : you'll see of which side the ball is nearest.
you can also do this if the ball is bigger, but you'll have to take in account the speed of the ball : you determine the position of the "front" of the ball then you compare it to the position of the square.
B
8
S
1
Posts: 76
Reputation: 628

Post » Wed Jul 29, 2015 10:47 pm

sounds good thank you!!
B
11
S
2
G
1
Posts: 84
Reputation: 852

Post » Thu Jul 30, 2015 5:46 am

On ball collision with square
(sub event) compare 2 values ball.x > square.x -> destroy ball 3
(sub event) compare 2 values ball.x < square.x -> destroy ball 1
B
88
S
44
G
16
Posts: 1,009
Reputation: 17,971


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests