Jump to content
• Advertisement

Public Group

# vectors (not arrays) C++

This topic is 3078 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

##### 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

##### Share on other sites
Quote:
 Original post by clashieI 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

##### Share on other sites
angle of incidence equals angle of reflection

#### Share this post

##### Share on other sites
Quote:
Original post by NextEpisode1
Quote:
 Original post by clashieI 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

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5
A4L
13
• Advertisement

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013643
×

## Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!