ball bouncing experiment with goal always perfect angle CAPX

Show us your works in progress and request feedback

Post » Thu Mar 05, 2015 3:58 pm

This little experiment is for the old school breakout style games and similar games where the ball or bullet would ricochet around in proper angles and not stray off at strange angles.
Plus not leaving the boundary.

I discovered that Custom Movements is much better than the Bullet behavior for the keeping the angles proper.

Also, @rexrainbow Boundary is great to keep the sprite inside the area and not have problem with escaping balls/bullets!

What do you think?

Requires plugin Boundary.

The ball do go beyond the boundary in high speed/low spec computer but at least it will still be inside the box and not escape or go off in strange angles.

Feel free to use this example in your works. But please use your own graphic for blocks.
You do not have the required permissions to view the files attached to this post.
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Thu Mar 05, 2015 8:06 pm

Nevermind, it is not sound coding once I added more varied angles from a paddle... the blocks bounce off code is NOT good at all, lol. >_<; I wish I had more talent for math!!
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Fri Mar 06, 2015 12:28 pm

Whenever I get stuck on a maths problem I search the forum for "problemname" & author="R0J0hound", & usually find my answer :)

The last example he posted here might be helpful: viewtopic.php?f=147&t=121599&p=867906&hilit=bouncing#p867906

As long as your sprites are all orthogonal you could use the isOverlappingAtOffset tests on lines 7-10 to work out which way to mirror the current velocity, & it should work even if you hit a corner.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Fri Mar 06, 2015 5:44 pm

@mattb thanks!! I will examine that one! I have another thread in the questions forum on this, haha. ;)
B
58
S
18
G
13
Posts: 447
Reputation: 10,740


Return to Works in Progress/Feedback Requests

Who is online

Users browsing this forum: No registered users and 2 guests