Enemies

Pages: 1234
You still haven't resolved the issue I hinted you towards.

It's something incredibly, incredibly simple and you'll feel like an idiot when you notice it.
closed account (o1vk4iN6)
Do you know about constness ? Stuff like getters and such which don't modify the class should be defined as const. Also passing a std::string by value isn't cheap it has to allocate new memory and copy the string, passing by const reference would be ideal.

1
2
3
4
5
6
7
8
9
10
11
12

class Player
{
    // ...

    int getHealth() const { return health; }

    // ...
};

Animation::Init( const std::string& filename /* ... */ ) { }


Also use a third party website, like pastebin, to post that much code so you don't inflate the thread like it already is ...
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
void Animation::UpdateAnim()
{
	if(Pause == false)
	{
		// Every cycle add 1 to the delay
		Delay++;

		// If the delay hit the point where it needs to change the frame...
		if(Delay == FrameChange)
		{
			// Reset the delay
			Delay == 0;
			Frame++;    // Go to the next frame
			
			// If the frame is at the last, we reset the animation.
			if(Frame > Graphic->w/W - 1)
			{
				Frame = 0;
			}
		}
	}

	// If the animation is paused...
	else
	{
		// If the frame is paused, as soon as it's unpaused we don't want
		// it to immediately switch frames
		Delay = 0;
	}
}


There is something wrong specifically in here. It might actually be responsible for the issue you are currently suffering. It is... well, painfully obvious.
closed account (N36fSL3A)
I cannot see what you're hinting at D;
closed account (o1vk4iN6)
Is it so hard to say there is a typo ?

1
2
3
// Reset the delay
Delay == 0;
Frame++;    // Go to the next frame 
closed account (N36fSL3A)
I fixed that already.
closed account (N36fSL3A)
I still get an error with istream
closed account (3qX21hU5)
first fix your compiler errors then the debugger is your friend and you can use it
Last edited on
closed account (N36fSL3A)
I have no compiler errors and I don't know how to use the debugger.
closed account (3qX21hU5)
I don't know how to use the debugger


You know what they say "The best time to learn something new is now".
closed account (N36fSL3A)
How can I learn?
Go on your compiler's website, and look for documentation of their debugger features.
Check your debugger site documentation, search through the threads here as I remember being told a few things about a debugger here. Google, when you have questions, before asking, Google for results to get an idea.

http://www.cplusplus.com/forum/unices/73830/
closed account (o1vk4iN6)
Well depends on what debugger you are using, visual studio's is probably the easiest as you don't need to really look at any assembly. There's also GDB though I prefer to have a gui as it makes it easier to scroll through assembly (might just be a feature gdb lacks or i don't know of, but it just prints chunks at a time).

Go on your compiler's website, and look for documentation of their debugger features.


Plenty of debuggers that don't come with compilers.
Last edited on
Judging from the image posted on he previous page Fred is using Visual C++ 2010 express. That being the case here's a link from google http://www.codeproject.com/Articles/79508/Mastering-Debugging-in-Visual-Studio-2010-A-Beginn
I only skimmed it, but if you get about halfway through it should be enough to give you an idea.
Last edited on
closed account (N36fSL3A)
Thanks. So where would i start on this?
closed account (3qX21hU5)
I donno maybe by reading tutorials or the articles listed by Lachlan? Start where you want to start we aren't your personal trainers...
closed account (N36fSL3A)
All of them? I meant what chapter to start.
At the beginning, the first chapter. The page I linked isn't really that long; 80 percent of the tutorial is screen shots.
closed account (N36fSL3A)
Mkay thanks. I'll post here for any more questions.
Pages: 1234