Advertisement

04.08 - Animation Anticipation

Started by June 02, 2001 02:25 PM
51 comments, last by Teej 21 years, 10 months ago
Thanks! The computer player is pretty simple, he basically just charges in the direction of the other player shooting wildly and tries to dodge any bullet that are coming close to him. He sorta freaks out when he gets too close to the human player though


"Fall seven times, stand up eight."
-Japanese Proverb
Swede:

quote:
Weatherman, i''m pretty sure you can''t put static in the declaration when there isn''t any variable declared. It''s the instance of the variable that you declare static.


You''re right, of course. Try this:


struct FIGHTER {
int xPos;
int yPos;
};

static FIGHTER f={(SCREEN_WIDTH/4)-(SPRITE_WIDTH/2)};
Advertisement
hey Swede,

try using

typedef struct TagFIGHTER {
int xPos;
int yPos;
ACTION action; // A predefined data type
int hits;
} FIGHTER;

insted of

struct FIGHTER {
int xPos;
int yPos;
ACTION action; // A predefined data type
int hits;
};

regards,
Nixter070479.
regards, Nixter070479.
Swede,
I'm pretty sure you've simply done something wrong.
Try the code below. You'll see that the shape struct is declared globally, and that each time the program calls sizer(), the values of the static circle (is-a relationship) shape are retained. That can only mean one thing - you aren't incrementing your variables, or the code that does is being skipped due to the values of your conditional operands.

Remember to use your watch, trace and assert debugging methods

void sizer(void);

struct shape{
int radius;
int diameter;
};

int main(int argc, char* argv[])
{
for (int x = 0; x < 5; x++)
sizer();

return 0;
}

void sizer(void)
{
static shape circle = {4, circle.radius*2};

printf("size %d\n", circle.radius);
printf("diameter %d\n", circle.diameter);

circle.radius++;
circle.diameter++;
}


Output:
size 4
diameter 8
size 5
diameter 9
size 6
diameter 10
size 7
diameter 11
size 8
diameter 12

Edited by - videns on June 16, 2001 8:07:52 PM
EZ
Ible, your computer character was pretty damned funny--good job. I was wondering if you would post the source on your site--right now all that is included is the globals.h file, which I was wondering why you included at all since none of the rest of the source was included. Keep up the good work.
Hi..

I´m trying to implement an algorithm(i think it´s the word) to make one man detect the other and stop move if it has the same X,Y coordinates.. This way the charachters don´t pass trough.

I have tryed to stop move if the x1 == x2 and move again if the direction is diferent of ambiguous directions!! For example:

if the man1 Direction is E and man2 is W sooner or later they will colide! Then, when this occurs, stop move.. When a new direction become, the stop move is false!!! But it doesn´t work very well!!! Someone has an better idea, or an implemented code in this idea i can use? Any help will be welcome!!! thanks!
Advertisement
Hi..

I´m trying to implement an algorithm(i think it´s the word) to make one man detect the other and stop move if it has the same X,Y coordinates.. This way the charachters don´t pass trough.

I have tryed to stop move if the x1 == x2 and move again if the direction is diferent of ambiguous directions!! For example:

if the man1 Direction is E and man2 is W sooner or later they will colide! Then, when this occurs, stop move.. When a new direction become, the stop move is false!!! But it doesn´t work very well!!! Someone has an better idea, or an implemented code in this idea i can use? Any help will be welcome!!! thanks!
To code is to make things come to life ;)
Cheesehonkey: The code is now included in the zip file on my site. Thanks for pointing out my mistake. Good coding.



"Fall seven times, stand up eight."
-Japanese Proverb
Teej,
I''m keep getting site not found from your site. When will it be up, or has someone got the files on a different site for download?
what''s got two legs and bleeds?Half a dog!
Teej,
I''m keep getting site not found from your site. When will it be up, or has someone got the files on a different site for download?
what''s got two legs and bleeds?Half a dog!

This topic is closed to new replies.

Advertisement