Make an object bounce?

Get help using Construct 2

Post » Sat Oct 01, 2011 10:03 am

A quick question... how do I make a moving bullet object accurately bounce off straight walls?
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Sat Oct 01, 2011 10:21 am

there was a post on forum for CC about perfect collisions, can't find it now, but i have uploaded project file from that post

http://dl.dropbox.com/u/34375299/perfect%20bounce%20off%20circle.cap

Don't remember how made it, sorry :/

ImageImageImageImage
B
156
S
64
G
41
Posts: 2,589
Reputation: 34,603

Post » Sat Oct 01, 2011 11:45 am

I don't have Construct Classic, so this file is not really much good. If it's any help, the walls are all perfectly vertical and horizontal.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Sat Oct 01, 2011 12:44 pm

You could try to apply force upwards on collision with the boundary sprites you specify. I also did a check to see if the X coord was < 200, so it's a little more realistic.


http://dl.dropbox.com/u/17612316/example/bouncy_ball.capx
B
2
S
1
G
1
Posts: 4
Reputation: 608

Post » Sat Oct 01, 2011 9:30 pm

Thanks, but the object is not a physics object. The problem really lies in the fact that the bullet does not know the angle of the surface it is hitting.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Sat Oct 01, 2011 10:37 pm

Search for "bounce", "bouncing", "bouncing ball".
There have already been topics about a similar subject you can learn a great deal from.

I remember someone even posting a formula to a pong ball behavior type, in events.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
276
S
103
G
84
Posts: 7,289
Reputation: 83,098

Post » Sun Oct 02, 2011 7:22 am

I saw this, however it does not solve the problem at all. All it does is make it move in the opposite direction - not bounce accurately.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Sat Oct 08, 2011 3:43 am

Hi sqiddster

The only way I could figure out how to make an object accurately bounce off straight walls was to get rid of the bullet object, and use the CustomMovement object instead. Here is an example I made.


Bouncing Ball Example


You will have to play around with the CustomMovement actions if you want to adjust, or change things.


Hope this helps.Wink2011-10-08 04:12:06
B
50
S
11
G
8
Posts: 479
Reputation: 9,926

Post » Sat Oct 08, 2011 5:10 am

I managed to do the same thing as you, but with the bullet behavior. The ends of walls, however, present a problem.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Sat Oct 08, 2011 5:38 am

What kind of problem are you having with the ends of the walls?
B
50
S
11
G
8
Posts: 479
Reputation: 9,926

Next

Return to How do I....?

Who is online

Users browsing this forum: Aenopix and 2 guests