Jump to content
  • Advertisement

Archived

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

Daboy

Game Question

This topic is 6061 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

Hey, im making a little game that involves a cannon witch u can lower and raise and fire....and i made picture of it at different heights and different stages of fire... I figured out how to make it switch from higher to lower but how can i link several images in a row??? plz respond if u know how...Thanks

Share this post


Link to post
Share on other sites
Advertisement
I''m assuming when u say ''link several images'' u mean to display the cannon with multiple frames.

All u need to do is create a struct like so...
(one way of doing it)

  
typedef CANNON
{
RECT rcFrames[MAX_FRAMES];
WORD nCurrentFrame;
POINT ptScreenPos;
}


Then make an instance of the struct:
CANNON Cannon;

Fill its initial variables:
SetRect(&Cannon.rcFrames[0], 0,0,32,32);
SetRect(&Cannon.rcFrames[1], 32,0,64,32);
SetRect(&Cannon.rcFrames[2], 64,0,96,32);
etc...
Cannon.ptScreenPos.x = 100;
Cannon.ptScreenPos.y = 100;
Cannon.nCurrentFrame = 0;




Update the current frame variable every frame or so:
Cannon.nCurrentFrame++;
if(Cannon.nCurrentFrame >= MAX_FRAMES) Cannon.nCurrentFrame = 0;

Then blit it by parsing the rect to ->Blt()
lpDDSCannon->Blt(.., &Cannon.rcFrames[Cannon.nCurrentFrame], ..)


Hope this helps :)


Downloads, D3DXSprite tutorial, New platform game: .-= The ZeroOne Realm =-.

Share this post


Link to post
Share on other sites
Hey,

Don''t post in more than one forum just to "get more attention." People will read your post if you just post it in ONE forum.

Keep your posts to one forum please.

Thanks!

Share this post


Link to post
Share on other sites
ive been posting this for a week now.... and answer me than i really want to get this done im not trying to be rude

Share this post


Link to post
Share on other sites
Nobody has the divine right to get replies. Sometimes you just need to be more patient, or ask a better question. Please don''t abuse our board by cross-posting.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ok bud than tell me what to do when u dont know what forum to put it in?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Ok bud than tell me what to do when u dont know what forum to put it in?

Ask. Or apologize at the top of the thread:

I really don''t know if this belongs here, but this is what came to mind. The situation is...





I wanna work for Microsoft!

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!