Im making a game in C++, but I have rused in to some problems that I hope you can help me with or give advice about what I can do.

1. The first thing I want to do is making it look like the main character is moving, like changing pictures between like 4-5 pictures if I press the UP-Key, and another 4-5picuters when hitting the DOWN-key. You get the idea i hope? Because now it looks like the character i sliding on the map, because it's 1 picture for each key. Any tips ? Code?

2. The second thing I want to do is making figthing possible. Right now the main char can run in to eniemes randomly placed on the map, then it starts a new window, kind of looking like Pokemon style, the main char on side och the enimie on the other. So in this place I want to be able to attack of course perhaps something else like run och defence. But in order for this to happen I must make HP points/bar Exp points/bar and hitpower like that stuff. I have been making some classes for Main char and Enimies, but I dont get it to work and have no Idea how to make a HP / Exp bar. So any tips on this ?

Ok, I didn't know about the code tags, this is my first post on allegro.

I just want to ask something about kdevils answer on the first question.

Ok say that I make that array, how do declare the array to the diffrent Bitmaps, I mean where in the code do should I load the the diffrent Bitmaps? And also should I make 4 diffrents arrays for each UP,DOWN,LEFT,RIGTH key?

And to answer your latest question, you can use a multidimensional array... so like, frames[LEFT][0], frames[LEFT][1], etc... maybe that's what you want? You might do that for each action, like walkframes[LEFT][0], and punchframes[LEFT][0].

Ick, that sounds like a lot of maintenance to me. I use a sprite class that has a BITMAP for a picture containning all the character motions and one BITMAP that is used for storing the single image. Every time I change where I'm grabbing from off the set-of-pictures-bitmap, I update the single-motion bitmap. This way, outside of the class, I only have to worry about the single-motion bitmap (and I don't really have to worry about that either, considering the class takes care of drawing itself too). This isn't a new method or anything.

True, my example certainly isn't the best way to deal with sprites. I'd instead use a datafile, a sprite class like you said, or something else that requires less "copy & paste", but as a simple example it works well enough.

-----"I am the Black Mage! I casts the spells that makes the peoples fall down!"

Also, your version will crash when rs == 100. You only declared data as an array of 100 ints, which is data[0..99].

This applies to your resetEnemyData() function as well.

Your setLvl() function is extremely inelegant. I can't suggest a better method, since I'm not sure what you're doing, and the code is too messy (especially without indentation) for me to bother deciphering it. But, with 35 lines in a row of data[##] = 1;, you really need to look at finding a better way.

I also noticed that your main() function is 140 lines long. You should break it up into smaller sections, such as setup routines, input routines, output routines. Then group related functions together in their own files and link them together rather than having one huge source file.

I really appreciate all the help you have gave me. I have just one more question, I'm going to make it possible to attack the enemies when they pop up. Should I make a class for the enemies, where I declare the HP, Strength, Level, Hitpower? I just one some pointers where to begin, it always the hardest.