Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Woody FX

Got my Engine Woprkin..but how to i display units?

This topic is 5931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got my isometric engine working and it takes in and displays my map for me and i'm well pleased with that. (Doing this Project in VC++ 6 and DirectX8) But i've no idea how to get my main character up on the map. I dont know what format to make the animation as... the colour i should put the back ground(invisible transparent) as, how many bits of animation i should have for the main character(he can walk in 8 different directions, maybe two for each direction, left foot forward & right foot forward. How to load them in then, how the computer can tell which frame is which. What values need to be saved about my main character who will be moved about by clickin on a location on the map(with the mouse ;-p )and the character will then walk to there. Will need to hold the Characters x,y coordinate , destination x,y coordinate a flag if he is movin or not. Maybe some pointer to where all the graphics for this character are stored....just guessing about the graphics...thats really where i need all your help! If there is examples of code or graphics i'd appreciate it! B_Doyle1@yahoo.com_NO_Spam (leave out _NO_Spam) ;-D Thanks for taking the time to help Briam Edited by - Woody FX on February 24, 2002 10:41:41 AM

Share this post


Link to post
Share on other sites
Advertisement
There is no one way to do it. I suggest you write out everything you need. Then think about how to do them, and write that out too. At this point you should be able to actually code them.

Share this post


Link to post
Share on other sites
Yeah....but read what i asked....that is a good way to find what i need but not how to do it...

I''ve asked the question because i''m stuck at this point... not able to figure out the answer myself

Thanks Brian

Share this post


Link to post
Share on other sites
You could go and have a look at Nehe''s Zelda. This is a tiled based game. Only it''s written with OpenGL and not Directx but maybe you can learn how to do it.

Good luck

Share this post


Link to post
Share on other sites
I''ve got a grasp of DirectX....and i''m really running out of time
plus a lot of other stuff that i''ve got to study for college as exams are in 2 weeks....so no time to start in to some thing new like openGL

But thanks for your input
Brian

Share this post


Link to post
Share on other sites
Maybe you''d a have a structure/record/class for a frame of the characters animation.

- frame name
- binary graphic data
- whatever

Then maybe you''d have an array of these frames.

Maybe you''d know which frames make up a (e.g. walking) animation and on each refresh of the display you''d write the relevant one to the screen.

Maybe you''d also store the x,y location of the unit so that your display routine can calculate where to put the graphic.

Maybe.

Share this post


Link to post
Share on other sites
I want to tell you to: study, then code...

But I''ll give a little hint about the animation.
Draw your pictures (same width) and make a VERY "tall" image. Copy each frame in some logical order (S #1, S #2, SE #1 etc). Load the whole image in and here''s some code:

  

#define PIC_SIZE 64*128

#define S_1 0
#define S_2 PIC_SIZE
#define SE_1 (2*PIC_SIZE)
#define SE_2 (3*PIC_SIZE)
etc...

int direction,
frame;

char *pic = loadCrap("jox.blah");

if (walking) frame = (frame + 1) & 1;

if (turning) direction += angle;

drawImage(someX, someY, 64, 128, pic + frame + direction*2);



Just give the offset of the wanted picture and draw. No extra lookup-files or crappy stuff, everything''s in one file.

Share this post


Link to post
Share on other sites
Thanks Coelurus, nice code!

Can you elaborate a bit on what all the

#define S_1 0#define S_2 PIC_SIZE#define SE_1 etc....etc

is about


char *pic = loadCrap("jox.blah"); what is goin on here

you are saying load the file(graphics) but how does the program tell which is frame 1 and 2 etc

Thanks Brian

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!