Jump to content
  • Advertisement
Sign in to follow this  
NextEpisode1

vectors (not arrays) C++

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hy , im currently in the design phase of my 2d "basketball game" project. Can any1 tell me some tutorial (or to post some simple class with 2 vectors that can be added or whatever) on 2D vectors (im not talking about arrays). I can perform operations with them on paper but how to code that i have no clue, thx in advance.

Share this post


Link to post
Share on other sites
Advertisement
I think you have bigger problems if this is giving you trouble.

It's just a struct with a couple simple functions. Look into classes and operator overloading.

Share this post


Link to post
Share on other sites
Quote:
Original post by clashie
I think you have bigger problems if this is giving you trouble.

It's just a struct with a couple simple functions. Look into classes and operator overloading.


that was helpful thanks,

it thats so simple help me out: a bullet thats described by line0 (POINT a, POINT b) with velocity=5 is hitting a wall at a 30 degree angle (as an example), bounce that back , i'm not saying its rocket science either.

I hope that make at least any sense

Share this post


Link to post
Share on other sites
Quote:
Original post by NextEpisode1
Quote:
Original post by clashie
I think you have bigger problems if this is giving you trouble.

It's just a struct with a couple simple functions. Look into classes and operator overloading.


that was helpful thanks,

it thats so simple help me out: a bullet thats described by line0 (POINT a, POINT b) with velocity=5 is hitting a wall at a 30 degree angle (as an example), bounce that back , i'm not saying its rocket science either.

I hope that make at least any sense


Thats a physics caluclation and slightly different from your first question.

Make your vector a class not a struct, internally to C++ structs are classes anyway but they arent in C, so use classes instead of structs as they support proper protection level.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!