Hello guys and thanks for reading my thread. First of all I would like to say that I am a complete newby to dark GDK though not to programming in general. I am learning C/C++ still but I know the basics so far. Anyway I hope I posted this into the right place, please correct me if not.
I am currently working on a game with my younger brother (hes a good pixel artist, anyways) Here is a snippet of my code, question following:
dbCreateAnimatedSprite(2,"Sprite Resources//Hinata//HinataBasicMovement.bmp",12,2,2);
dbCreateAnimatedSprite(3,"Sprite Resources//Hinata//HinataJump.bmp",4,2,3);
dbSprite(2,1,Resolution_Height-55,2); // Resolution_Height-55 represents my current resolution height minus animation height (so it stands on the bottom of the screen
while (LoopGDK())
{
if (dbKeyState(32) == 1)
{
//Move: Right
Facing = 0;
if (CurrentDirection != 1)
{
dbSetSpriteFrame(2,1);
CurrentDirection = 1;
}
dbRotateSprite(2,90);
dbMoveSprite(2,1);
dbRotateSprite(2,0);
dbPlaySprite(2,1,6,60);
//End
}
else
if (dbKeyState(30) == 1)
...
Ok I experimented with a few things here .. I have defined the variable Facing to help me know which side I am currently facing in order to play other animations correctly sided, CurrentDirection I use for telling me basicaly if I changed the position, because then it has to stop the current animation by setting it to the correct dbSetSpriteFrame() in order to fix those issues I had that played my last animation to end before they started new one (looked laggy).
Here is my question:
As you can see I made two animations one for the Walk and other for the Jump cycle. I would like to know how could I use two different animations on a single sprite? Or could I simply make a new sprite somehow, position it to where the old one was and then delete the old one? The thing is my brother made about 100 different animations x) .. well the sprite sheet is so huge and has things of various sizes, it could be a little problem to resize that all correctly.
I wanted to use small animation packets and call them when I need them on different parts of my code. I tried both animations seperated and they work perfectly. Running/Standing on both left and right works. Now when I try to make the "jump" i come into the problem where I have to load the 2nd animation to the first sprite (OR) as I said already recreate one on same location and delete the old one.. Sadly i don't know how I could do this
First idea does not work. When I load a new image to an old sprite it kinda messes the whole thing up.. The animation does not play correctly even that in a seperated sprite it works. So I moved to my second idea..
The second idea was to use the second sprite which when created gave no issues, position it to the correct X/Y location on the screen where the old one was and then delete old one.. The issues here were that I couldnt find a function to return the current X/Y coordinates to me. Also a big trouble would be that dbMoveSprite() and such functions would require a complete change of their parameters...
I am new to dark GDK so I might over look an easy way around this..
Sorry on the huge post. Hope I explained everything well. I gave as much information as I currently have, but if you didn't understand something just ask it right away. I realy cant move on with my project until I fix this..
Thanks in Regrads ~Froobzi