My best goal atm is just make one 1vs1 battle with no animations more than something which makes me realize the attack is done.
I'm learning C and Xlib, and now I know how to put an image in a window in Xlib.
Yes, it's nothing, but it was my first goal, show images in a window, and then start to do things.
So now I'm starting to think how I will make the game.
Since I'm thinking how make a low quality battle 1vs1 with no more than the two sprites and a black background in a window, I'm focusing in the battle "system" to make a little base and see how things will go.
I think the way is this (Maybe you know a better one, but it's just what i was testing one day and it works):
The map has coords like X and Y, so the sprites or enemies or whatever is in the game, are occuping some X and Y.
Then to use an attack I will take the X and Y of the attacker, and move one of them depending on the direction the attacker is looking.
For example, I want attack with a melee skill. I'm looking at right, so I take my X coord and move the X one step (maybe copying it in a variable first). This will be done with something like X=X+1; or X+=1; So my Y coord still unchanged, but my X is one step to right, then it's like I moved to right, but I'm still in my position because are the coords who are moving, not me really.
Then I make a condition like if X and Y are equal to Xenemy and Yenemy then, do attack.
So the base is move my coords or someone coords and do the attack moving X and Y and testing if they are the same of the enemy.
The ranged attacks will be the same, but repeating the process depending on range until it's done or the range is out.
X++; if (X and Y are equal to Xtarget Ytarget) then do attack; else X++ and try again until the range is out or attack is done;
But, my questions are:
How I should do to attack more than 1 enemy? I need test all the coords of all sprites while I do this, or there is a better way like a selectable target or something?
I should use the Window coords, and the pixmap coords (the images or sprites) and copy them to attack, or I should make a new map with different X and Y?
What I must have in mind for the future? I mean, how I should make all coordinates and be sure the method I'm using is not lacking something which I should realize?
I'm having a wrong start? I guess I'm wrong when I'm focusing on only one target.
I guess the ranged skills should have X and Y, move on the map, and affect whatever is in the X and Y. But I have no more idea than test all the possible targets every time the skill cords move.
There is a way to create a global target to test only one location and know if there is an attackable target?
BTW: I will appreciate some corrections on my english. I will remember it, so I will learn with your edits. I guess formatting is not needed and will be useless since there is no real code, but maybe you can do or add something to explain better what I'm trying to say.
I must say sorry for my bad english, I'm spanish and the english level here is shit. I've learned more playing wow on pirate servers than at the school and now reading programming docs.
If you know some books, info or questions I can look, please share it if they will be useful for me.