Jump to content

  • Log In with Google      Sign In   
  • Create Account


Squared'D

Member Since 08 Apr 2013
Offline Last Active Yesterday, 08:24 PM
-----

Posts I've Made

In Topic: Why are my two classes sharing variables? C++

31 March 2014 - 12:27 AM

I think i found out the bug today guys. Basically what happened was that i declared an array of octorocks:
OCTOROCK octorocks[4];
But what i did wrong was that initialized it like this
octorock[1].x =......
octorock[2].x =......
octorock[3].x =......
octorock[4].x =......
What i did wrong is that i didnt access octorock[0] and did a memory violation by going out of bounds in tbe array with octorock[4].


Don't worry. Mistakes like this are quite common. That's why I tend to look to see if I've made silly mistakes first when debugging. I hate it when I end up making major changes when the original bug just turns out to be a missing minus or something. Glad you found the answer.

In Topic: Why are my two classes sharing variables? C++

23 March 2014 - 11:08 PM

If you still can't find the problem, put a break point in the code that fires the projectile and step through the code one line at a time keeping the variables in a watch window. I agree that it's either bad pointer management or you put an assignment somewhere and didn't notice.

In Topic: Why are my two classes sharing variables? C++

23 March 2014 - 06:35 PM

I'm curious about whether or not you were able to solve the problem. Non-fully answered forum post can bring such misery.

 

 

wisdom_of_the_ancients.png


In Topic: Why are my two classes sharing variables? C++

22 March 2014 - 06:50 AM

I'm on my phone and can't see all of your code, but from looking at the video, I wonder if it's your collision code. Maybe you put "=" instead of "==".

In Topic: Top Or Bottom?

09 March 2014 - 11:36 PM

I generally put the interface at the top and private members and classes at the bottom because users of the class(including myself) shouldn't be bothered by the implementation so why make them wade through it before they get to what they need? Even when it comes to the interface, I put methods that will be used the most at the top.

That the default access in classes is private has never been a concern to me. I've always thought of it more as a reminder that member variables in classes should be private.

My head doesn't explode when others do the opposite way though.

PARTNERS