Public Group

# 2D Games Maths

This topic is 3774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
I think for bouncing off the wall it was just a matter of inverting the x and y velocity of the ball.

X = x*-1.
Y = y*-1

The hard bit was getting the ball to bounce off the paddles at different angels.

##### Share on other sites
I suggest you keep doing what you are doing. Make one game, and then make another, peaking back to get the bits you dont have down. Dont copy+paste them, but read them, go over why you need it, then re-write it. Its just practice. Eventually, (possibly much sooner then you'd expect) you'll find the event of looking back at someing is almost rare.

And the warm fuzzy feeling when you make a game from scratch without a single peek for the first time, is pretty nice if you slug it out.

Just whatever you do, dont stop coding, unless its to play games of course. Or eat, work, sleep etc.

##### Share on other sites
Hi there i know how you feel math i snot my overal strong point. So what you need to look up is vector mathamatics. With it you can determine where something will be wether or not two lines intersect witch can be used for determining wther or not the ball has hit something and best off all you can use angels as for when a ball hits a wall the angl einverters based on its direcotionality :) witch can be determined by its angel.

Gamedev.net here has a bunch of math artical you may wish to read up on and it may help clear up some issue you are having.

Regards Jouei.

Remmber to rate pepole on how they help you that is what it is there for.

##### Share on other sites
Geometry. Lots. Also trig.

Though, I'd recommend you go for vector math instead of trig. For me, it is easier and more logical and the great thing is it'll be much more applicable once you move into 3D.

##### Share on other sites
A general understanding of geometry is helpful and Trig is important to help you understand the things you'll be doing with vectors and matrices, which is where the real meat is located.

The specific problem you're trying to solve is known as "reflection" search that term on Wikipedia or a good math site like Wolfram's.

##### Share on other sites
If you're a working developer then you probably have an income. A wise investment for you would be to buy an introductory textbook on Calculus & Analytic Geometry. There are literally hundreds available and most are of decent quality. While you *can* find this information online, having it presented in a coherent single source, with worked examples and practice problems, will give you a far more comprehensive understanding of the mathematics, allowing you to apply it liberally in your games programming.

I can recommend Stewart's 'Calculus' text and its companion 'Linear Algebra for Calculus', having used both for many years to teach undergraduate level mathematics.

Beyond the mathematics study, you should read up on kinematics and dynamics, which is the mathematical description of the motion and interaction of physical bodies.

All of this might seem like overkill just to work out how to do a rebound from a wall in your breakout game and if that were your only aim then the above recommendation *is* overkill. However, you stated your interest was in learning how to develop games and for that an understanding of some elementary mathematics is an invaluable skill.

As for the lack of information regarding '2D maths' as opposed to '3D maths', 2D is just a simpler case of the 3D problem. Everything that works in 3D works in 2D and is easier to solve. 2D is often a good way to introduce a problem because it contains the inherent attributes. Ultimately though, most people will simply address the 3D case, simply because it is more relevant to everyday life.

Timkin

##### Share on other sites
Wow, thanks to everyone who took the time to reply!

Thanks Timkin for the book recommendations. My sentiments exactly about a single reference book vs variety of online resources. I had looked into some introductory Maths textbooks, but as you say there is a plethora of options available so thanks for your recommendations, I'll be sure to check them out!

Thanks Ravyne for the suggestion of going to Wolframs, very interesting stuff. Also thanks to everyone else who offered suggestions. You've all given me new key words to google with while I get around to organising a reference text.

Cheers,
Gray

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
11

• 12
• 19
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632665
• Total Posts
3007711
• ### Who's Online (See full list)

There are no registered users currently online

×