Game Question

Started by
6 comments, last by Daboy 22 years, 5 months ago
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
Jordan Weberwww.pheonixsoftware.com
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 =-.

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

is that pascal???(im using delphi)
Jordan Weberwww.pheonixsoftware.com
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!
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
Jordan Weberwww.pheonixsoftware.com
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.
Ok bud than tell me what to do when u dont know what forum to put it in?
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!

This topic is closed to new replies.

Advertisement