Search found 35 matches

by indus
February 13th, 2013, 2:35 am
Forum: Everything
Topic: Char into Int issue, (to me unexplainable behavior)
Replies: 2
Views: 3655

Re: Char into Int issue, (to me unexplainable behavior)

Here Youll find your answer.
Validation and error checking is a must.
by indus
February 3rd, 2013, 9:31 am
Forum: Everything
Topic: Is there an alternative?
Replies: 4
Views: 2175

Re: Is there an alternative?

I dont really understand what are you trying to do. But I'll point out some error in the given code. First of all your function is a bool. This means that you have to return a bool value on exit. If your index gets greater than 10 you dont enter the for loop and dont return anything from the functio...
by indus
January 28th, 2013, 9:19 am
Forum: Everything
Topic: Question re UpdateAnimation and currentFrameExposure
Replies: 5
Views: 2674

Re: Question re UpdateAnimation and currentFrameExposure

Here is a great article on game loop. Pretty good explained and outlining pluses vs. minuses of each implementation.
by indus
January 27th, 2013, 1:29 pm
Forum: Everything
Topic: How to instialize an array of classes( in progress )
Replies: 40
Views: 16078

Re: How to instialize an array of classes( in progress )

I think you should start over with the project. Don't get me wrong. It is just too messy now. You have 2 bases and marines moving between them. For those 3 things you create 5-6 classes and almost each of them inherits from somewhere. And most of the inheritance does not make sense. Like for example...
by indus
January 23rd, 2013, 3:25 pm
Forum: Everything
Topic: pass values between functions?
Replies: 14
Views: 6341

Re: pass values between functions?

Yes thats correct. The setMethod sets the value of a given private attribute and the getMethod gets the value of that attribute and returns it. You might as well define just a getMethod without a setter and this way you`ll never be able to change the value of the attribute. class Planet { private: s...
by indus
January 23rd, 2013, 8:14 am
Forum: Everything
Topic: pass values between functions?
Replies: 14
Views: 6341

Re: pass values between functions?

Well glad I could help a bit. Seems as if you have M_distance as a public attribute. That is considered to be bad practices. You want to keep your class elements private is what all the hardcore c++-ers will tell you. Thats why you'll eventually need access modifiers (get and set methods). Like this...
by indus
January 22nd, 2013, 8:25 am
Forum: Everything
Topic: pass values between functions?
Replies: 14
Views: 6341

Re: pass values between functions?

You declare an array of Planet objects and than go with the for loop planet* planArray = new planet[planetNum]; // in order to be able to do that you need // to have a default constructor defined for (int i = 0; i < planetNum; i++) { // you can use here setters the same way as the // getters in the ...
by indus
January 21st, 2013, 12:15 pm
Forum: Everything
Topic: Just Wondering
Replies: 5
Views: 2694

Re: Just Wondering

If you do a MMO you should be storing the data on a server not on each client pc.
by indus
January 21st, 2013, 5:54 am
Forum: Everything
Topic: pass values between functions?
Replies: 14
Views: 6341

Re: pass values between functions?

Thats actually easily solvable with oop. You have two classes. Star and Planet. In the Planet class create a constructor taking those 3 parameters from star that you need. In the main method You create an Object of type star and after that using this object you can access its private components by u...
by indus
January 19th, 2013, 8:23 pm
Forum: Everything
Topic: How to instialize an array of classes( in progress )
Replies: 40
Views: 16078

Re: How to instialize an array of classes

This approach of creating array in the class is wrong. The last version was working correctly. The only problem with it was that you are creating surfacesequence which consists of multiple surfaces every time you call the Marine constructor. So if you make an array of 10 marines you create 10 times ...