Path: chuka.playstation.co.uk!news From: Tones Newsgroups: scee.yaroze.freetalk.english Subject: Re: Animation Date: Fri, 14 May 1999 17:30:44 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 98 Message-ID: <373C4FB4.40503AE4@yaroze2000.freeserve.co.uk> References: <373AEAC2.5D25C39E@which.net> NNTP-Posting-Host: 193.82.133.189 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; I) Hi Andrew, Don't know of any tutorials, 'cos I was in a similar situation nearly a year ago. If your still stuck in the meantime, try using arrays to store your u and v values- it's quick and a great deal easier to maintain. Ie. : #define NUM_ANIMS (23) // Number of animations #define ANIM_LEN_1 (10) //10 Frame animation int ANIM1U[10] = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; // U positions for anim 1 which has 10 frames int ANIM1V[10] = { 0, 0, 0, 0, 0, 30, 30, 30, 30, 30 }; // V positions for anim 2 Ie then to set player1 to frame 2 of anim 1 , do player1.u = ANIM1U[1], player1.v = ANIM1V[1]; Then all I do is call an animition procedure which handles EVERY type of animation you have set up. Even better, if you define an animation structure as an array the size of the number of animations, you can do all sorts of cool routines, and it's bloody easy to maintain, such as : struct ANIM_STRUCT { int ANIM_DELAY; // How long to delay between each frame int CURRENT_FRAME; // How far into the animation has it played? int STILL_PLAYING; // Is the animation still playing ? int COUNTER; // How long till the next frame plays (I.e. has the counter reached the delay variable for this animation?) } ANIM_DETAIL[NUM_ANIMS]; Make sure you write an initialisation routine though, so that the values are set for later use. If your interested, my procedure for the animation handler in my new game (which is still a secret :) ) looks like this : void AnimPlayer1Control(int AnimNumber, int *AnimArrayU, int *AnimArrayV) // Pass the animation you want to play, and the pointers to the ANIM1U { // array (or ANIM2U etc) and the V array. // This procedure controls the animation routines required for Player 1 ANIM_DETAIL[AnimNumber].COUNTER++; PLAYER_DETAIL[PLAYER_ONE].CURRENT_ANIM = AnimNumber; PLAYER_DETAIL[PLAYER_ONE].STILL_PLAYING=1; PLAYER_DETAIL[PLAYER_ONE].AnimArrayU = AnimArrayU; PLAYER_DETAIL[PLAYER_ONE].AnimArrayV = AnimArrayV; if ( ANIM_DETAIL[AnimNumber].COUNTER > ANIM_DETAIL[AnimNumber].ANIM_DELAY ) { ANIM_DETAIL[AnimNumber].COUNTER=0; if ( ANIM_DETAIL[AnimNumber].CURRENT_FRAME < LENANIM[AnimNumber] ) { player1.u = AnimArrayU[ANIM_DETAIL[AnimNumber].CURRENT_FRAME]; player1.v = AnimArrayV[ANIM_DETAIL[AnimNumber].CURRENT_FRAME]; ANIM_DETAIL[AnimNumber].CURRENT_FRAME++; } else { ANIM_DETAIL[AnimNumber].COUNTER=0; ANIM_DETAIL[AnimNumber].CURRENT_FRAME=0; ANIM_DETAIL[AnimNumber].STILL_PLAYING = 0; PLAYER_DETAIL[PLAYER_ONE].STILL_PLAYING=0; //Reset Player 1 to normal standing stance player1.u = P1_STAND_U; player1.v = P1_STAND_V; } } } // *********end*********** I know it's a little crap - but it does the job nicely. If you base yours around this, or if someone else does it a little tidier, use that - but otherwise the general rule of thumb is pretty much the same no matter which way you do it. And as everything is controlled by arrays, you can muck around with the sizes and settings to your hearts content! Hope this helps, Cheers! Tones 8) Andrew Murray wrote: > Does anyone know where I can pick up a tutorial on 2D animation on the > Net Yaroze? > > Cheers.